{"record":{"id":"a05545c967c6ee77","repo":"sipeed/picoclaw","slug":"error-loading-config-w-a05545","errorCode":null,"errorMessage":"error loading config: %w","messagePattern":"error loading config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/picoclaw/internal/cron/command.go","lineNumber":28,"sourceCode":")\n\nfunc NewCronCommand() *cobra.Command {\n\tvar storePath string\n\n\tcmd := &cobra.Command{\n\t\tUse:     \"cron\",\n\t\tAliases: []string{\"c\"},\n\t\tShort:   \"Manage scheduled tasks\",\n\t\tArgs:    cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, _ []string) error {\n\t\t\treturn cmd.Help()\n\t\t},\n\t\t// Resolve storePath at execution time so it reflects the current config\n\t\t// and is shared across all subcommands.\n\t\tPersistentPreRunE: func(_ *cobra.Command, _ []string) error {\n\t\t\tcfg, err := internal.LoadConfig()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error loading config: %w\", err)\n\t\t\t}\n\t\t\tstorePath = filepath.Join(cfg.WorkspacePath(), \"cron\", \"jobs.json\")\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(\n\t\tnewListCommand(func() string { return storePath }),\n\t\tnewAddCommand(func() string { return storePath }),\n\t\tnewRemoveCommand(func() string { return storePath }),\n\t\tnewEnableCommand(func() string { return storePath }),\n\t\tnewDisableCommand(func() string { return storePath }),\n\t)\n\n\treturn cmd\n}\n","sourceCodeStart":10,"sourceCodeEnd":45,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/picoclaw/internal/cron/command.go#L10-L45","documentation":"Every `picoclaw cron <subcommand>` first runs the command's PersistentPreRunE, which loads the config (internal.LoadConfig) to compute storePath = <workspace>/cron/jobs.json shared by list/add/remove/enable/disable. This error means that config load failed before any subcommand logic ran.","triggerScenarios":"Any `picoclaw cron list|add|remove|enable|disable` when the config file is missing, unreadable, or fails parsing/validation, or the workspace path cannot be derived from it.","commonSituations":"First run before onboarding/init completed; hand-edited config with syntax errors; PICOCLOW_HOME pointing somewhere wrong; running as a user without read access to the config.","solutions":["Repair the config first: run `picoclaw config path`, fix syntax/permissions, or re-run onboarding","Unset or correct PICOCLOW_HOME if it was overridden","Retry the cron subcommand once other picoclaw commands load config without error"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"picoclaw config validate && picoclaw cron list  # run the cheap config check first; fix any error before other cron subcommands","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Complete onboarding/init before using cron subcommands","Keep the config readable by the invoking user","Re-check PICOCLOW_HOME when scripts change environments"],"tags":["cron","config","cli"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}