sipeed/picoclaw · error
error loading config
Error message
error loading config: %w
What it means
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.
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
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at cmd/picoclaw/internal/agent/helpers.go:28 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/cf9bc2242eaeab3d.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/picoclaw/internal/agent/helpers.go:28
"strings"
"github.com/ergochat/readline"
"github.com/sipeed/picoclaw/cmd/picoclaw/internal"
"github.com/sipeed/picoclaw/pkg/agent"
"github.com/sipeed/picoclaw/pkg/bus"
"github.com/sipeed/picoclaw/pkg/logger"
"github.com/sipeed/picoclaw/pkg/providers"
)
func agentCmd(message, sessionKey, model string, debug bool) error {
if sessionKey == "" {
sessionKey = "cli:default"
}
cfg, err := internal.LoadConfig()
if err != nil {
return fmt.Errorf("error loading config: %w", err)
}
logger.ConfigureFromEnv()
if debug {
logger.SetLevel(logger.DEBUG)
fmt.Println("🔍 Debug mode enabled")
}
if model != "" {
cfg.Agents.Defaults.ModelName = model
}
provider, modelID, err := providers.CreateProvider(cfg)
if err != nil {
return fmt.Errorf("error creating provider: %w", err)
}
View on GitHub (pinned to 49183d7e8d)