{"record":{"id":"e7451efc682c875e","repo":"gastownhall/beads","slug":"rendering-managed-sql-server-config-w","errorCode":null,"errorMessage":"rendering managed sql-server config: %w","messagePattern":"rendering managed sql-server config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/doltserver/doltserver.go","lineNumber":1393,"sourceCode":"\t\tif !explicitPort {\n\t\t\tattempts = maxEphemeralPortAttempts\n\t\t}\n\n\t\tfor i := range attempts {\n\t\t\tif !explicitPort {\n\t\t\t\tp, allocErr := allocateEphemeralPort(cfg.Host)\n\t\t\t\tif allocErr != nil {\n\t\t\t\t\tlastErr = allocErr\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tactualPort = p\n\t\t\t}\n\n\t\t\tvar cmdArgs []string\n\t\t\tif useArchiveLevelConfig {\n\t\t\t\tcfgBody, cfgErr := buildDoltServerYAMLConfig(cfg.Host, actualPort, debug, cfgDir)\n\t\t\t\tif cfgErr != nil {\n\t\t\t\t\tlastErr = fmt.Errorf(\"rendering managed sql-server config: %w\", cfgErr)\n\t\t\t\t\tif !explicitPort {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\t// filepath.Abs defensively: the child's cwd is doltDir (cmd.Dir\n\t\t\t\t// below), so a relative configPath would resolve against the\n\t\t\t\t// wrong directory (matches the sibling dbproxy/server path,\n\t\t\t\t// which abs's its configPath in NewDoltServer).\n\t\t\t\tabsConfigPath, absErr := filepath.Abs(doltServerConfigPath(beadsDir))\n\t\t\t\tif absErr != nil {\n\t\t\t\t\tlastErr = fmt.Errorf(\"resolving managed sql-server config path: %w\", absErr)\n\t\t\t\t\tif !explicitPort {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif werr := os.WriteFile(absConfigPath, cfgBody, 0600); werr != nil {","sourceCodeStart":1375,"sourceCodeEnd":1411,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/doltserver/doltserver.go#L1375-L1411","documentation":"When archive-level config is used, Start() renders the managed dolt sql-server YAML via buildDoltServerYAMLConfig(host, port, debug, cfgDir). Any error from that renderer (e.g. absolutizing or validating paths inside cfgDir) is wrapped as 'rendering managed sql-server config'. With a non-explicit port the loop retries; with an explicit port it breaks and fails with lastErr.","triggerScenarios":"useArchiveLevelConfig is true and buildDoltServerYAMLConfig fails, typically because paths derived from cfgDir/doltDir cannot be resolved (bad cfgDir from error 1620's resolver passing, but paths later failing).","commonSituations":"Relative or symlinked beadsDir producing unresolvable config paths; cfgDir removed between resolve and render (race); unusual characters in data-dir path breaking config rendering.","solutions":["Verify the beads data dir and .doltcfg directory exist and contain valid, absolute paths.","Avoid symlinks or relative paths in the configured beadsDir; use an absolute path.","Re-run after fixing permissions so resolveCfgDir produces a valid cfgDir.","If failure persists with an explicit port, switch to port 0 (ephemeral) to let the retry loop pick a fresh allocation."],"exampleFix":"// before\nBD_DIR=~/beads  # resolves via symlink to a moved volume\n// after\nBD_DIR=/absolute/stable/path/beads","handlingStrategy":"validation","validationCode":"const cfgDir = path.join(dataDir, '.doltcfg');\nawait fs.access(cfgDir, fs.constants.W_OK);\nif (!path.isAbsolute(dataDir)) console.warn('use an absolute beadsDir');","typeGuard":"null","tryCatchPattern":"try {\n  await bdStart();\n} catch (e) {\n  if (/rendering managed sql-server config/.test(e.message)) {\n    // retry once with ephemeral port (port 0) to let the loop reallocate\n  }\n  throw e;\n}","preventionTips":["Use absolute, symlink-free data-dir paths.","Don't mutate the beads dir while bd is starting.","Keep .doltcfg present and writable.","Avoid exotic characters in data-dir paths."],"tags":["config","yaml","startup"],"backgroundTag":"server-config-render-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}