{"record":{"id":"455d0c920c6ef457","repo":"gastownhall/beads","slug":"writing-s-w","errorCode":null,"errorMessage":"writing %s: %w","messagePattern":"writing (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/configfile/proxied_server_client_info.go","lineNumber":52,"sourceCode":"\t}\n\tvar info ProxiedServerClientInfo\n\tif err := json.Unmarshal(data, &info); err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing %s: %w\", ProxiedServerClientInfoFileName, err)\n\t}\n\treturn &info, nil\n}\n\nfunc SaveProxiedServerClientInfo(beadsDir string, info *ProxiedServerClientInfo) error {\n\tif info == nil {\n\t\tinfo = &ProxiedServerClientInfo{}\n\t}\n\tdata, err := json.MarshalIndent(info, \"\", \"  \")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"marshaling %s: %w\", ProxiedServerClientInfoFileName, err)\n\t}\n\tpath := ProxiedServerClientInfoPath(beadsDir)\n\tif err := os.WriteFile(path, data, 0o600); err != nil {\n\t\treturn fmt.Errorf(\"writing %s: %w\", ProxiedServerClientInfoFileName, err)\n\t}\n\treturn nil\n}\n\nfunc resolveSidecarPath(beadsDir, p string) string {\n\tif p == \"\" {\n\t\treturn \"\"\n\t}\n\tif filepath.IsAbs(p) {\n\t\treturn p\n\t}\n\treturn filepath.Join(beadsDir, p)\n}\n\nfunc (i *ProxiedServerClientInfo) ResolvedRootPath(beadsDir string) string {\n\tif i == nil {\n\t\treturn \"\"\n\t}","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/configfile/proxied_server_client_info.go#L34-L70","documentation":"After marshaling succeeds, SaveProxiedServerClientInfo writes the JSON to the sidecar file (mode 0600) via os.WriteFile. This error wraps any filesystem write failure, prefixed with the sidecar filename. It is the standard I/O failure path for persisting proxied-server client info.","triggerScenarios":"os.WriteFile fails on ProxiedServerClientInfoPath(beadsDir): the .beads directory does not exist, the file/dir is read-only, disk is full, or permission is denied for the current user.","commonSituations":"Running bd as a different user than the one who owns ~/.beads; read-only filesystem or container; disk quota exceeded; beadsDir pointing at a deleted or never-created directory.","solutions":["Read the wrapped %w error — typically 'permission denied' or 'no such file or directory'.","Ensure the beads directory exists (bd normally creates it; mkdir -p the path if needed).","Fix filesystem permissions (chown/chmod the .beads dir, mode 0700) or free disk space.","Verify BEADS_DIR / beadsDir points to a writable location."],"exampleFix":"// before\nerr := configfile.SaveProxiedServerClientInfo(beadsDir, info)\n// after\nif err := os.MkdirAll(beadsDir, 0o700); err != nil {\n    return err\n}\nerr := configfile.SaveProxiedServerClientInfo(beadsDir, info)","handlingStrategy":"validation","validationCode":"if st, err := os.Stat(beadsDir); err != nil || !st.IsDir() {\n    return fmt.Errorf(\"beads dir %s not usable: %w\", beadsDir, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the beads directory is created (os.MkdirAll beadsDir 0700) before saving.","Run bd under the same user that owns ~/.beads.","Check free disk space and that the filesystem is not mounted read-only.","Confirm BEADS_DIR points at a writable location."],"tags":["filesystem","io","config-file"],"backgroundTag":"file-write-permission-denied","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}