{"record":{"id":"a8f088b515001c7d","repo":"charmbracelet/crush","slug":"failed-to-load-config-from-paths-v-w","errorCode":null,"errorMessage":"failed to load config from paths %v: %w","messagePattern":"failed to load config from paths (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/load.go","lineNumber":49,"sourceCode":"\tpowernapConfig \"github.com/charmbracelet/x/powernap/pkg/config\"\n\t\"github.com/qjebbs/go-jsons\"\n\t\"github.com/tidwall/gjson\"\n\t\"github.com/tidwall/sjson\"\n)\n\nconst defaultCatwalkURL = \"https://catwalk.charm.land\"\n\n// Load loads the configuration from the default paths and returns a\n// ConfigStore that owns both the pure-data Config and all runtime state.\nfunc Load(workingDir, dataDir string, debug bool) (*ConfigStore, error) {\n\t// Migrate deprecated disable_notifications before loading config.\n\tmigrateDisableNotifications()\n\n\tconfigPaths := lookupConfigs(workingDir)\n\n\tcfg, loadedPaths, err := loadFromConfigPaths(context.Background(), configPaths)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load config from paths %v: %w\", configPaths, err)\n\t}\n\n\tcfg.setDefaults(workingDir, dataDir)\n\n\tstore := &ConfigStore{\n\t\tconfig:         cfg,\n\t\tworkingDir:     workingDir,\n\t\tglobalDataPath: GlobalConfigData(),\n\t\tworkspacePath:  filepath.Join(cfg.Options.DataDirectory, fmt.Sprintf(\"%s.json\", appName)),\n\t\tloadedPaths:    loadedPaths,\n\t}\n\n\tif debug {\n\t\tcfg.Options.Debug = true\n\t}\n\n\t// Load workspace config last so it has highest priority.\n\tif wsData, err := os.ReadFile(store.workspacePath); err == nil && len(wsData) > 0 {","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/config/load.go#L31-L67","documentation":"Returned by config.Load when loadFromConfigPaths fails while reading/parsing the discovered config files (crushrc / crush.json) at the candidate paths. The message includes the exact list of paths attempted and the underlying parse or read error.","triggerScenarios":"Calling config.Get (or Load) when a crushrc/crush.json file in the working or home directory has a syntax error, uses unknown builtins, or cannot be read (permissions/I-O). configPaths in the message identify which files were involved.","commonSituations":"Hand-edited crushrc with a Bash syntax error; invalid values passed to builtins like provider/model/mcp; deprecated crush.json with schema mistakes; unreadable config file after permission changes.","solutions":["Read the wrapped error for the specific file and line of the config mistake and fix the syntax/value.","Validate the crushrc with bash -n or by sourcing it in a test shell to catch syntax errors.","Check file permissions on the listed config paths.","Migrate deprecated crush.json settings to crushrc if the JSON schema is the problem.","Temporarily rename the config files to confirm they are the source of the failure."],"exampleFix":"// before (crushrc)\nprovider anthropic {\n  model claude\n  missing_quote = \"oops\n}\n// after\nprovider anthropic {\n  model claude-sonnet-4-5\n  api_key_env = ANTHROPIC_API_KEY\n}","handlingStrategy":"validation","validationCode":"// shellcheck-style pre-check of crushrc before launching\nif out, err := exec.Command(\"bash\", \"-n\", crushrcPath).CombinedOutput(); err != nil {\n\treturn fmt.Errorf(\"invalid crushrc: %s\", out)\n}","typeGuard":"func isConfigLoadError(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"failed to load config from paths\")\n}","tryCatchPattern":"if err != nil && isConfigLoadError(err) {\n\t// the message lists offending paths; show them and the wrapped cause to the user\n\treturn fmt.Errorf(\"fix your crush config: %w\", err)\n}","preventionTips":["Run bash -n on crushrc after every edit.","Use only documented shell builtins (provider, model, mcp, lsp, permissions, hook, options).","Keep crush.json migrated to crushrc to avoid deprecated-schema issues.","Keep config files under version control to spot bad edits quickly."],"tags":["config","parsing","crushrc"],"backgroundTag":"config-parse-failed","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}