hasura/graphql-engine · error

creating Version table failed %s

Error message

creating Version table failed %s

What it means

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).

Source

Thrown at cli/internal/statestore/settings/hdbtable.go:151

	}

	// Now Create the table
	query = hasura.PGRunSQLInput{
		Source: s.sourceName,
		SQL: `CREATE TABLE ` + fmt.Sprintf(
			"%s.%s",
			s.schema,
			s.table,
		) + ` (setting text not null primary key, value text not null)`,
	}

	resp, err = s.client.PGRunSQL(query)
	if err != nil {
		return errors.E(op, err)
	}

	if resp.ResultType != hasura.CommandOK {
		return errors.E(op, fmt.Errorf("creating Version table failed %s", resp.ResultType))
	}

	if err := s.setDefaults(); err != nil {
		return errors.E(op, err)
	}

	return nil
}

func (s *StateStoreHdbTable) setDefaults() error {
	var (
		op       errors.Op = "statestore.StateStoreHdbTable.setDefaults"
		sql      string
		sqlSb137 strings.Builder
	)
	for _, setting := range Settings {
		sqlSb137.WriteString(
			`INSERT INTO ` + fmt.Sprintf(

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Verify the Hasura source is healthy and consistent (check /v1/metadata or console) and retry
  2. Confirm the Hasura server version is compatible with your CLI version
  3. Check that the role used by the CLI has privileges to create tables in the source database
  4. Inspect server logs for the actual SQL failure reason
Defensive patterns

Strategy: try-catch

Try / catch

err := settings.PrepareSettingsDriver(...)
if err != nil {
    if strings.Contains(err.Error(), "creating Version table failed") {
        // check server/source health before retrying
    }
    return err
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/445389ecabc549ed. Report an issue: GitHub.