{"record":{"id":"445389ecabc549ed","repo":"hasura/graphql-engine","slug":"creating-version-table-failed-s-445389","errorCode":null,"errorMessage":"creating Version table failed %s","messagePattern":"creating Version table failed (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/internal/statestore/settings/hdbtable.go","lineNumber":151,"sourceCode":"\t}\n\n\t// Now Create the table\n\tquery = hasura.PGRunSQLInput{\n\t\tSource: s.sourceName,\n\t\tSQL: `CREATE TABLE ` + fmt.Sprintf(\n\t\t\t\"%s.%s\",\n\t\t\ts.schema,\n\t\t\ts.table,\n\t\t) + ` (setting text not null primary key, value text not null)`,\n\t}\n\n\tresp, err = s.client.PGRunSQL(query)\n\tif err != nil {\n\t\treturn errors.E(op, err)\n\t}\n\n\tif resp.ResultType != hasura.CommandOK {\n\t\treturn errors.E(op, fmt.Errorf(\"creating Version table failed %s\", resp.ResultType))\n\t}\n\n\tif err := s.setDefaults(); err != nil {\n\t\treturn errors.E(op, err)\n\t}\n\n\treturn nil\n}\n\nfunc (s *StateStoreHdbTable) setDefaults() error {\n\tvar (\n\t\top       errors.Op = \"statestore.StateStoreHdbTable.setDefaults\"\n\t\tsql      string\n\t\tsqlSb137 strings.Builder\n\t)\n\tfor _, setting := range Settings {\n\t\tsqlSb137.WriteString(\n\t\t\t`INSERT INTO ` + fmt.Sprintf(","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/internal/statestore/settings/hdbtable.go#L133-L169","documentation":"Thrown by PrepareSettingsDriver when creating the Version table in the Hasura server's metadata database fails: the SQL statement ran but the server did not return CommandOK. This is part of the CLI's settings/state store bootstrap against a Hasura source (HDB).","triggerScenarios":"Calling PrepareSettingsDriver (or any CLI flow that initializes the settings store, e.g. metadata/migration setup) against a Hasura source where executing the CREATE TABLE ... version SQL returns a non-OK result type (error payload, permission denial, inconsistent source).","commonSituations":"Hasura server version mismatch, source not properly connected, insufficient permissions on the target database for the Hasura admin role, or the source being in an inconsistent state.","solutions":["Verify the Hasura source is healthy and consistent (check /v1/metadata or console) and retry","Confirm the Hasura server version is compatible with your CLI version","Check that the role used by the CLI has privileges to create tables in the source database","Inspect server logs for the actual SQL failure reason"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := settings.PrepareSettingsDriver(...)\nif err != nil {\n    if strings.Contains(err.Error(), \"creating Version table failed\") {\n        // check server/source health before retrying\n    }\n    return err\n}","preventionTips":["Health-check the Hasura source before running CLI setup commands","Pin CLI and server versions that are known compatible"],"tags":["hasura","database","migration","settings"],"backgroundTag":"database-table-creation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}