{"record":{"id":"5df533e6e6686c79","repo":"golang-migrate/migrate","slug":"unable-to-parse-file-v-5df533","errorCode":null,"errorMessage":"unable to parse file %v","messagePattern":"unable to parse file (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"source/go_bindata/go-bindata.go","lineNumber":63,"sourceCode":"\tif _, ok := instance.(*AssetSource); !ok {\n\t\treturn nil, ErrNoAssetSource\n\t}\n\tas := instance.(*AssetSource)\n\n\tbn := &Bindata{\n\t\tpath:        \"<go-bindata>\",\n\t\tassetSource: as,\n\t\tmigrations:  source.NewMigrations(),\n\t}\n\n\tfor _, fi := range as.Names {\n\t\tm, err := source.DefaultParse(fi)\n\t\tif err != nil {\n\t\t\tcontinue // ignore files that we can't parse\n\t\t}\n\n\t\tif !bn.migrations.Append(m) {\n\t\t\treturn nil, fmt.Errorf(\"unable to parse file %v\", fi)\n\t\t}\n\t}\n\n\treturn bn, nil\n}\n\nfunc (b *Bindata) Close() error {\n\treturn nil\n}\n\nfunc (b *Bindata) First() (version uint, err error) {\n\tif v, ok := b.migrations.First(); !ok {\n\t\treturn 0, &os.PathError{Op: \"first\", Path: b.path, Err: os.ErrNotExist}\n\t} else {\n\t\treturn v, nil\n\t}\n}\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/golang-migrate/migrate/blob/01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a/source/go_bindata/go-bindata.go#L45-L81","documentation":"Raised by the go-bindata driver's WithInstance while iterating assets: when a file parses successfully (passes DefaultParse) but its version number collides with an already-appended migration, Append returns false and the driver fails with 'unable to parse file %v'. Files that fail parsing outright are silently skipped, so this error specifically indicates duplicate version numbers.","triggerScenarios":"WithInstance on an asset source whose embedded migration files contain two entries with the same version number.","commonSituations":"Regenerating go-bindata assets after adding a migration that reuses an existing version number; two branches each adding migrations with the same version before merging; copy-pasted filenames with different extensions (001_x.sql and 001_x.sql.bak both embedded).","solutions":["List the embedded asset names and find files resolving to the same version number","Rename the duplicate to a unique, higher version number","Regenerate the bindata asset bundle after renaming so stale entries are removed","Exclude non-migration copies (e.g. .bak, editor backups) from the embedded assets"],"exampleFix":"// before (embedded assets)\n002_add_index.sql\n002_add_index.sql.bak\n// after — remove or rename the .bak, then regenerate assets\n002_add_index.sql","handlingStrategy":"validation","validationCode":"names := AssetDir(\"migrations\")\nseen := map[uint]string{}\nfor _, n := range names {\n    m, err := source.DefaultParse(n)\n    if err != nil {\n        continue\n    }\n    if prev, dup := seen[m.Version]; dup {\n        return fmt.Errorf(\"duplicate version %d: %s vs %s\", m.Version, prev, n)\n    }\n    seen[m.Version] = n\n}","typeGuard":null,"tryCatchPattern":"d, err := bindata.WithInstance(assetSource)\nif err != nil && strings.HasPrefix(err.Error(), \"unable to parse file\") {\n    return fmt.Errorf(\"duplicate migration versions embedded in assets: %w\", err)\n}","preventionTips":["Regenerate the bindata bundle after every migration file change","CI check: parse all embedded asset names and assert unique versions","Exclude editor/backup files from embed patterns"],"tags":["go-bindata","migration","duplicate","assets"],"backgroundTag":"duplicate-migration-version","analyzedSha":"01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a","analyzedAt":"2026-09-02T19:38:29.671Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}