tracecraft icon indicating copy to clipboard operation
tracecraft copied to clipboard

init --backend hf fails on a non-existent bucket with a cryptic error (should auto-create or fail-fast)

Open Arrmlet opened this issue 5 months ago • 0 comments

Summary

tracecraft init --backend hf fails when the target HF Bucket doesn't already exist, with a cryptic error. The command that's meant to initialize a project can't bootstrap the bucket it needs, and the failure message doesn't point at the cause.

What happened

First-time setup against a brand-new HF bucket handle:

$ tracecraft init --backend hf --bucket arrmlet/tracecraft-apex \
    --project text_clustering --agent claude-code --hf-token "$HF_TOKEN"
Added .tracecraft.json to .gitignore
Error: HF put failed: text_clustering/agents/claude-code.json.
Make sure the repository and revision exist before writing data.

The error sent me down two wrong paths before I found the fix:

  1. Assumed a permissions/token problem (it wasn't).
  2. Created a HF dataset repo arrmlet/tracecraft-apex (wrong resource type — hf.py writes to hf://buckets/..., i.e. an HF Bucket, not a dataset repo). Still failed.

The actual fix was to pre-create the Bucket out-of-band:

from huggingface_hub import HfApi
HfApi(token=HF_TOKEN).create_bucket("arrmlet/tracecraft-apex", private=True)

After that, init succeeded immediately.

Why it's confusing

  • init sounds like it provisions everything (its help: "Initialize tracecraft config, create bucket, and register agent"). The help even says "create bucket" — but it doesn't.
  • The error "Make sure the repository and revision exist" is HfFileSystem-level and doesn't mention buckets or create_bucket.

Suggested fix (either)

  1. Auto-create the bucket in init (call HfApi.create_bucket(..., exist_ok=True) before the first write). Matches what the help text already promises.
  2. Or, fail fast with an actionable message: detect the missing bucket and print Bucket 'arrmlet/tracecraft-apex' does not exist. Create it first: tracecraft bucket create ... (or pass --create-bucket).

Option 1 is the turnkey experience.

Env

  • tracecraft-ai 0.2.1, huggingface_hub 1.12.0, macOS, HF backend.

Arrmlet avatar Jun 07 '26 23:06 Arrmlet