{"record":{"id":"6651906bcc20807f","repo":"gastownhall/beads","slug":"ensureproxiedserverconfig-render-yaml-w","errorCode":null,"errorMessage":"ensureProxiedServerConfig: render YAML: %w","messagePattern":"ensureProxiedServerConfig: render YAML: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/proxied_server.go","lineNumber":155,"sourceCode":"\tif err := os.MkdirAll(root, config.BeadsDirPerm); err != nil {\n\t\treturn \"\", fmt.Errorf(\"ensureProxiedServerConfig: mkdir %s: %w\", root, err)\n\t}\n\n\tswitch _, err := os.Stat(path); {\n\tcase err == nil:\n\t\treturn path, nil\n\tcase !os.IsNotExist(err):\n\t\treturn \"\", fmt.Errorf(\"ensureProxiedServerConfig: stat %s: %w\", path, err)\n\t}\n\n\tport, err := proxy.PickFreePort()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"ensureProxiedServerConfig: pick free port: %w\", err)\n\t}\n\n\tbody, err := renderProxiedServerConfig(port)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"ensureProxiedServerConfig: render YAML: %w\", err)\n\t}\n\tif err := atomicWriteFile(resolveConfigWriteTarget(path), body); err != nil {\n\t\treturn \"\", fmt.Errorf(\"ensureProxiedServerConfig: write %s: %w\", path, err)\n\t}\n\treturn path, nil\n}\n\n// resolveConfigWriteTarget resolves path to its physical location before\n// an atomic rewrite. os.Rename's destination argument does not follow\n// symlinks — it unlinks and replaces whatever is AT that path, symlink or\n// not — so writing straight to a symlinked config.yaml would silently\n// replace the symlink itself with a regular file instead of updating the\n// file it points at. Falls back to path unresolved when it does not exist\n// yet (filepath.EvalSymlinks errors on a missing path), which covers both\n// the ordinary \"no config.yaml yet\" case and a dangling symlink.\nfunc resolveConfigWriteTarget(path string) string {\n\tresolved, err := filepath.EvalSymlinks(path)\n\tif err != nil {","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/proxied_server.go#L137-L173","documentation":"After picking a port, ensureProxiedServerConfig renders the proxied-server YAML via renderProxiedServerConfig(port); any error from rendering is wrapped here. Since the input is a just-allocated int port, this almost always indicates a template execution failure or marshaling problem inside the renderer rather than bad user input.","triggerScenarios":"renderProxiedServerConfig(port) returns an error: the embedded config template fails to execute (template parse/execute bug, missing template function), text/template or yaml.Marshal fails on generated values, or a version skew leaves the template registry uninitialized.","commonSituations":"Corrupted or partially upgraded bd binary (embedded template assets missing/mismatched); a bd build with stripped/modified embedded resources; a bug in a newer template referencing an unknown field.","solutions":["Run `bd --version` / `bd doctor` and reinstall or upgrade bd to a clean, complete build (e.g. `go install ...@latest` or re-download the release) — a corrupted binary is the most common cause.","Check bd's issue tracker for known bugs in renderProxiedServerConfig matching your version; downgrade to the previous working release if a regression was shipped.","Delete any partially written config at the target path and let bd regenerate it from scratch (`rm <config-path>` then rerun).","If you build from source, verify embedded template assets are intact (clean checkout, `make` per README) rather than a dirty build.","File a bug with the full wrapped error if a stock binary reproduces it — template failures are usually internal defects."],"exampleFix":"// before\n$ bd serve   # bd built from dirty tree, embedded template missing\nensureProxiedServerConfig: render YAML: template: config: line 3: function \"beadsDir\" not defined\n// after\n$ make clean && make && ./bd serve   # or install an official release","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"path, err := ensureProxiedServerConfig(cfgPath)\nif err != nil {\n\tvar perr error\n\tif errors.As(err, &perr) && strings.Contains(err.Error(), \"render YAML\") {\n\t\t// template/render failure: reinstall or downgrade bd, then retry\n\t\tlog.Fatalf(\"config render failed (%v); reinstall bd and retry\", err)\n\t}\n\treturn err\n}","preventionTips":["Install bd from official releases; avoid dirty or hand-patched builds that can break embedded templates.","After upgrades, delete stale partially-written configs so a clean render is forced.","Pin a known-good bd version in CI; upgrade deliberately after checking release notes.","Report render failures with full wrapped output to the bd issue tracker — they are usually internal bugs."],"tags":["go","template","yaml","config-render","proxied-server"],"backgroundTag":"template-render-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}