{"record":{"id":"ec4b84a22e964954","repo":"ory/hydra","slug":"invalid-autocommit-flag-q","errorCode":null,"errorMessage":"invalid autocommit flag %q","messagePattern":"invalid autocommit flag %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"oryx/popx/match.go","lineNumber":86,"sourceCode":"\t\tswitch dbType {\n\t\tcase dbal.DriverYugabyteDB, \"yugabytedb\":\n\t\t\tdbType = dbal.DriverYugabyteDB\n\t\tdefault:\n\t\t\tdbType = pop.CanonicalDialect(dbType)\n\t\t}\n\t\tif dbType != dbal.DriverYugabyteDB && !pop.DialectSupported(dbType) {\n\t\t\treturn nil, errors.Wrapf(errUnsupportedMigrationDialect, \"%s\", dbType)\n\t\t}\n\t}\n\n\tif m[typeIdx] == \"fizz\" && dbType != \"all\" {\n\t\treturn nil, errors.Errorf(\"invalid database type %q, expected \\\"all\\\" because fizz is database type independent\", dbType)\n\t}\n\n\tif m[autocommitIdx] == \".autocommit\" {\n\t\tautocommit = true\n\t} else if m[autocommitIdx] != \"\" {\n\t\treturn nil, errors.Errorf(\"invalid autocommit flag %q\", m[autocommitIdx])\n\t}\n\n\treturn &match{\n\t\tVersion:    m[versionIdx],\n\t\tName:       m[nameIdx],\n\t\tDBType:     dbType,\n\t\tAutocommit: autocommit,\n\t\tDirection:  m[directionIdx],\n\t\tType:       m[typeIdx],\n\t}, nil\n}\n","sourceCodeStart":68,"sourceCodeEnd":98,"githubUrl":"https://github.com/ory/hydra/blob/4174065ffb052799890f7480f5360a877a67ffc1/oryx/popx/match.go#L68-L98","documentation":"The migration filename grammar allows an optional single .autocommit marker. parseMigrationFilename throws this error (oryx/popx/match.go:85) when the autocommit capture group contains something other than \".autocommit\" or empty. In practice the regex mostly constrains this, so the error fires when a filename places an unexpected token in the autocommit position.","triggerScenarios":"A migration filename where the 4th capture group (between the optional dialect segment and .up/.down) is a non-empty string other than .autocommit — e.g. a stray suffix like .nocommit or a misplaced .autocommit within the name segment.","commonSituations":"Hand-edited filenames adding unknown flags; copy-paste mistakes duplicating or misspelling .autocommit; tooling that inserts build metadata into the filename.","solutions":["Rename the file so the optional flag is exactly .autocommit (e.g. 20210101000000_name.all.autocommit.up.sql)","Remove the unsupported token from the filename entirely if autocommit behavior is not needed","Check the regex MigrationFileRegexp in oryx/popx/match.go to confirm the accepted filename shape"],"exampleFix":"// before\n20210101000000_name.all.nocommit.up.sql\n// after\n20210101000000_name.all.autocommit.up.sql","handlingStrategy":"validation","validationCode":"const pattern = `^(\\d+)_([^.]+)(\\.[a-z0-9]+)?(\\.autocommit)?\\.(up|down)\\.(sql)$`\nvar re = regexp.MustCompile(pattern)\n// ensure the only optional flag token is .autocommit\nif m := re.FindStringSubmatch(filename); m != nil && m[4] != \"\" && m[4] != \".autocommit\" {\n    return fmt.Errorf(\"invalid autocommit flag in %q\", filename)\n}","typeGuard":null,"tryCatchPattern":"if _, err := parseMigrationFilename(name); err != nil {\n    if strings.Contains(err.Error(), \"invalid autocommit flag\") {\n        return fmt.Errorf(\"rename %s: only .autocommit is a valid flag\", name)\n    }\n    return err\n}","preventionTips":["Use the exact .autocommit token; never invent custom flags in migration filenames","Lint migration filenames in CI against MigrationFileRegexp","Generate filenames with tooling instead of manual editing"],"tags":["migrations","file-naming","autocommit","database"],"backgroundTag":"invalid-migration-filename","analyzedSha":"4174065ffb052799890f7480f5360a877a67ffc1","analyzedAt":"2026-09-03T14:52:41.581Z","contentChangedAt":"2026-09-03T14:52:41.581Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}