sipeed/picoclaw · error

V2→V3 migration failed

Error message

V2→V3 migration failed: %w

What it means

Returned during config load when earlier migrations succeeded but migrateV2ToV3 failed the final transformation step. Since the map is only marshaled and written back after all migrations pass, a failure here means the file is still untouched; the wrapped error names the V2→V3 issue.

Solutions

  1. Inspect the wrapped error for the failing transformation rule
  2. Compare the V2 sections against the migrator's expectations (renamed or retyped fields)
  3. Manually migrate the config to the current version as a last resort, keeping a backup
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

Thrown at pkg/config/config.go:1360

			logger.ErrorCF(
				"config",
				formatDiagnosticLogMessage("Failed to load config", err),
				map[string]any{"path": path},
			)
			return nil, err
		}

		migrateErr := migrateV0ToV1(m)
		if migrateErr != nil {
			return nil, fmt.Errorf("V0→V1 migration failed: %w", migrateErr)
		}
		migrateErr = migrateV1ToV2(m)
		if migrateErr != nil {
			return nil, fmt.Errorf("V1→V2 migration failed: %w", migrateErr)
		}
		migrateErr = migrateV2ToV3(m)
		if migrateErr != nil {
			return nil, fmt.Errorf("V2→V3 migration failed: %w", migrateErr)
		}

		var migrated []byte
		migrated, err = json.Marshal(m)
		if err != nil {
			return nil, err
		}

		cfg, err = loadConfig(migrated)
		if err != nil {
			return nil, err
		}

		err = MakeBackup(path)
		if err != nil {
			return nil, err
		}

View on GitHub (pinned to 49183d7e8d)