sipeed/picoclaw · error
error loading config: %w
Error message
error loading config: %w
What it means
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.
Source
Thrown at cmd/picoclaw/internal/cron/command.go:28
)
func NewCronCommand() *cobra.Command {
var storePath string
cmd := &cobra.Command{
Use: "cron",
Aliases: []string{"c"},
Short: "Manage scheduled tasks",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
return cmd.Help()
},
// Resolve storePath at execution time so it reflects the current config
// and is shared across all subcommands.
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
cfg, err := internal.LoadConfig()
if err != nil {
return fmt.Errorf("error loading config: %w", err)
}
storePath = filepath.Join(cfg.WorkspacePath(), "cron", "jobs.json")
return nil
},
}
cmd.AddCommand(
newListCommand(func() string { return storePath }),
newAddCommand(func() string { return storePath }),
newRemoveCommand(func() string { return storePath }),
newEnableCommand(func() string { return storePath }),
newDisableCommand(func() string { return storePath }),
)
return cmd
}
View on GitHub (pinned to 49183d7e8d)
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
Defensive patterns
Strategy: validation
Validate before calling
picoclaw config validate && picoclaw cron list # run the cheap config check first; fix any error before other cron subcommands
Prevention
- Complete onboarding/init before using cron subcommands
- Keep the config readable by the invoking user
- Re-check PICOCLOW_HOME when scripts change environments
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- failed to load config: %w
- reset failed: %w
- either --every or --cron must be specified
- error adding job: %w
- failed to load config: %w
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/a05545c967c6ee77.
Report an issue: GitHub.