hasura/graphql-engine · error

invalid result Type

Error message

invalid result Type %s

What it means

MigrationStateStoreHdbTable.PrepareMigrationsStateStore ran its SQL via PGRunSQL and expected a TuplesOK result (rows), but the server returned a different result type — meaning the state-store table inspection query did not return tuples as expected.

Solutions

  1. Verify the CLI and Hasura server versions are compatible (same major release line)
  2. Check the configured admin secret/role can read hdb_catalog
  3. Look at server logs for the failing SQL and re-run the query manually to see the result type
  4. Reconnect directly to the server (no proxy) and retry
Defensive patterns

Strategy: try-catch

Try / catch

if err := store.PrepareMigrationsStateStore(); err != nil {
    if strings.Contains(err.Error(), "invalid result Type") { /* check server logs, version compat, privileges; retry */ }
}

Prevention

When it happens

Trigger: Preparing the hdb-table based migration state store when the server's response to the catalog query is not TuplesOK: server version mismatch returning an error payload, unexpected SQL behavior, or a proxy/permission layer altering responses.

Common situations: Pointing the CLI at an incompatible Hasura version or a non-Postgres data source, or a restricted role blocking hdb_catalog reads so the query returns a command/error type instead of tuples.

Related errors


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

Appendix: source

Thrown at cli/internal/statestore/migrations/hdbtable.go:130

	return nil
}

func (m *MigrationStateStoreHdbTable) PrepareMigrationsStateStore(sourceName string) error {
	var op errors.Op = "migrations.MigrationStateStoreHdbTable.PrepareMigrationsStateStore"
	// check if migration table exists
	query := hasura.PGRunSQLInput{
		Source: sourceName,
		SQL:    `SELECT COUNT(1) FROM information_schema.tables WHERE table_name = '` + m.table + `' AND table_schema = '` + m.schema + `' LIMIT 1`,
	}

	runsqlResp, err := m.client.PGRunSQL(query)
	if err != nil {
		return errors.E(op, err)
	}

	if runsqlResp.ResultType != hasura.TuplesOK {
		return errors.E(op, fmt.Errorf("invalid result Type %s", runsqlResp.ResultType))
	}

	result := runsqlResp.Result
	if result[1][0] != "0" {
		return nil
	}

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

	runsqlResp, err = m.client.PGRunSQL(query)

View on GitHub (pinned to 724551b9ae)