{"record":{"id":"cf9bc2242eaeab3d","repo":"sipeed/picoclaw","slug":"error-loading-config-w","errorCode":null,"errorMessage":"error loading config: %w","messagePattern":"error loading config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/picoclaw/internal/agent/helpers.go","lineNumber":28,"sourceCode":"\t\"strings\"\n\n\t\"github.com/ergochat/readline\"\n\n\t\"github.com/sipeed/picoclaw/cmd/picoclaw/internal\"\n\t\"github.com/sipeed/picoclaw/pkg/agent\"\n\t\"github.com/sipeed/picoclaw/pkg/bus\"\n\t\"github.com/sipeed/picoclaw/pkg/logger\"\n\t\"github.com/sipeed/picoclaw/pkg/providers\"\n)\n\nfunc agentCmd(message, sessionKey, model string, debug bool) error {\n\tif sessionKey == \"\" {\n\t\tsessionKey = \"cli:default\"\n\t}\n\n\tcfg, err := internal.LoadConfig()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error loading config: %w\", err)\n\t}\n\n\tlogger.ConfigureFromEnv()\n\n\tif debug {\n\t\tlogger.SetLevel(logger.DEBUG)\n\t\tfmt.Println(\"🔍 Debug mode enabled\")\n\t}\n\n\tif model != \"\" {\n\t\tcfg.Agents.Defaults.ModelName = model\n\t}\n\n\tprovider, modelID, err := providers.CreateProvider(cfg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating provider: %w\", err)\n\t}\n","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/picoclaw/internal/agent/helpers.go#L10-L46","documentation":"Context wrapper in agentCmd around internal.LoadConfig: the picoclaw configuration file (or auth state it depends on) could not be read, located, or parsed before the agent session starts. The wrapped %w carries the config-layer detail (missing file, bad YAML/JSON, invalid values); this layer only says where in the CLI flow it happened.","triggerScenarios":"Thrown at cmd/picoclaw/internal/agent/helpers.go:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error to see if the config file is missing, unreadable, or malformed","Create or repair the config file at the expected picoclaw config path (or run any init flow the CLI provides)","Validate the config file syntax with a YAML/JSON linter"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","contentChangedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}