sipeed/picoclaw · error

failed to load security config

Error message

failed to load security config: %w

What it means

Returned during config load of an already-current-version config: loading the companion security file (securityPath(path)) failed with something other than os.ErrNotExist — parse error, permission denied, or schema mismatch. The wrapped %w carries the security-config error; a simply missing file is tolerated, so this error means the file exists but is unreadable or invalid.

Solutions

  1. Check file permissions on the security config next to the main config
  2. Validate its format (YAML syntax, expected schema) and fix parse errors
  3. If the file is leftover garbage, move it aside — absence is handled gracefully
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pkg/config/config.go:1507 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/ecf7626dc76508da. Report an issue: GitHub.

Appendix: source

Thrown at pkg/config/config.go:1507

			"config migrate success",
			map[string]any{"from": versionInfo.Version, "to": CurrentVersion},
		)
	case CurrentVersion:
		// Current version
		cfg, err = loadConfig(data)
		if err != nil {
			logger.ErrorCF(
				"config",
				formatDiagnosticLogMessage("Failed to load config", err),
				map[string]any{"path": path},
			)
			return nil, err
		}
		// Load security configuration
		secPath := securityPath(path)
		err = loadSecurityConfig(cfg, secPath)
		if err != nil && !errors.Is(err, os.ErrNotExist) {
			return nil, fmt.Errorf("failed to load security config: %w", err)
		}

	default:
		return nil, fmt.Errorf("unsupported config version: %d", versionInfo.Version)
	}

	applyLegacyBindingsMigration(data, cfg)

	gatewayHostBeforeEnv := cfg.Gateway.Host

	if err = env.Parse(cfg); err != nil {
		return nil, err
	}
	applySkillsRegistryEnvCompat(cfg)

	if err = InitChannelList(cfg.Channels); err != nil {
		return nil, err
	}

View on GitHub (pinned to 49183d7e8d)