{"record":{"id":"f07f4c1d65a029d4","repo":"gastownhall/beads","slug":"failed-to-set-beads-role-config-w","errorCode":null,"errorMessage":"failed to set beads.role config: %w","messagePattern":"failed to set beads\\.role config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/init.go","lineNumber":2993,"sourceCode":"\t// Prompt for role\n\tfmt.Print(\"Contributing to someone else's repo? [y/N]: \")\n\n\tresponse, err := readLineWithContext(ctx, reader, os.Stdin)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to read input: %w\", err)\n\t}\n\tresponse = strings.TrimSpace(strings.ToLower(response))\n\n\tisContributor = response == \"y\" || response == \"yes\"\n\n\t// Set the role in git config\n\trole := \"maintainer\"\n\tif isContributor {\n\t\trole = \"contributor\"\n\t}\n\n\tif err := setBeadsRole(role); err != nil {\n\t\treturn isContributor, fmt.Errorf(\"failed to set beads.role config: %w\", err)\n\t}\n\n\treturn isContributor, nil\n}\n\n// promptAutoExport asks the user whether to enable optional auto-export.\n// Returns true to enable it, false to leave it disabled.\nfunc promptAutoExport() (bool, error) {\n\tfmt.Printf(\"\\n%s Auto-export can keep .beads/issues.jsonl up to date after write commands.\\n\", ui.RenderAccent(\"▶\"))\n\tfmt.Println(\"  This optional JSONL export is useful for viewers (bv), interchange, and issue-level migration.\")\n\tfmt.Println(\"  Dolt remotes/backups handle cross-machine sync and backup.\")\n\tfmt.Print(\"\\nEnable auto-export? [y/N]: \")\n\n\treader := bufio.NewReader(os.Stdin)\n\tresponse, err := readLineWithContext(getRootContext(), reader, os.Stdin)\n\tif err != nil {\n\t\tif isCanceled(err) {\n\t\t\treturn true, err","sourceCodeStart":2975,"sourceCodeEnd":3011,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/init.go#L2975-L3011","documentation":"This error wraps any failure from setBeadsRole during bd init's contributor-mode prompt. promptContributorMode decides whether the user is a maintainer or contributor, then persists 'maintainer' or 'contributor' into the beads.role config. If writing that config value fails (e.g. the config file cannot be written or the underlying config store errors), the error is wrapped with %w and returned, aborting init.","triggerScenarios":"Running bd init, answering the contributor-mode prompt, and setBeadsRole failing because the config file is unwritable, corrupted, or its parent directory is missing.","commonSituations":"Read-only home directory or BEADS config dir (permissions, sandboxed CI, read-only mounts); disk full; a corrupted beads config file; running init as a different user without write access to the existing config.","solutions":["Check write permissions on the beads config file/directory and fix with chmod/chown","Run bd init in a directory/user context that can write the config (avoid read-only HOME)","Inspect the beads config file for corruption; repair or delete it so init can recreate it","Re-run bd init; if it persists, run with the config path's error output to identify the underlying wrapped error"],"exampleFix":"// before: init fails under read-only HOME\n$ bd init\n// after: point HOME at a writable location or fix permissions\n$ export HOME=/home/writable && bd init\n# or\n$ chmod u+w ~/.config/beads/","handlingStrategy":"validation","validationCode":"if [ ! -w \"$HOME/.config/beads\" ]; then echo \"beads config dir not writable\"; exit 1; fi","typeGuard":null,"tryCatchPattern":"if _, err := promptContributorMode(); err != nil { var wrapped error; if errors.As(err, &wrapped) { log.Fatalf(\"init aborted: %v\", err) } }","preventionTips":["Ensure HOME/config dir is writable before running bd init","Avoid running init under read-only mounts or sandboxed users","Back up and validate the beads config file periodically","Check disk space on the config volume"],"tags":["config","init","filesystem","permissions"],"backgroundTag":"config-write-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}