{"record":{"id":"d44b1cbf5fecd60a","repo":"sipeed/picoclaw","slug":"migratev2tov3-expected-version-2-got-v","errorCode":null,"errorMessage":"migrateV2ToV3: expected version 2, got %v","messagePattern":"migrateV2ToV3: expected version 2, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/migration.go","lineNumber":349,"sourceCode":"\t\t\t}\n\t\t}\n\t} else {\n\t\tlogger.Warnf(\"model_list is not a slice: %#v\", m[\"model_list\"])\n\t}\n\n\tm[\"version\"] = 2\n\n\treturn nil\n}\n\n// migrateV2ToV3 converts a V2 config JSON to V3 format:\n//  1. Renames \"channels\" key to \"channel_list\"\n//  2. Converts flat-format channel entries to nested format (wrapping\n//     channel-specific fields in \"settings\")\n//  3. Sets version to 3\nfunc migrateV2ToV3(m map[string]any) error {\n\tif !compareInt(m[\"version\"], 2) {\n\t\treturn fmt.Errorf(\"migrateV2ToV3: expected version 2, got %v\", m[\"version\"])\n\t}\n\n\tmigrateLegacyAgentDefaultsModel(m)\n\tdelete(m, \"bindings\")\n\n\t// Rename channels → channel_list\n\tif channels, ok := m[\"channels\"]; ok {\n\t\tdelete(m, \"channels\")\n\n\t\t// Convert each channel from flat to nested format\n\t\tif chMap, ok := channels.(map[string]any); ok {\n\t\t\tfor k, ch := range chMap {\n\t\t\t\tif chVal, ok := ch.(map[string]any); ok {\n\t\t\t\t\tchVal[\"type\"] = k\n\t\t\t\t\t// If already has \"settings\" key, leave as-is\n\t\t\t\t\tif _, hasSettings := chVal[\"settings\"]; hasSettings {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/config/migration.go#L331-L367","documentation":"Error \"migrateV2ToV3: expected version 2, got %v\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/config/migration.go:349 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}