hasura/graphql-engine · error

failed to list inconsistent metadata: %w

Error message

failed to list inconsistent metadata: %w

What it means

The `metadata inconsistency list` command runs opts.run() to query the server for inconsistent metadata objects. This error wraps any failure of that listing operation — the server call failed, credentials were rejected, or the response could not be processed.

Source

Thrown at cli/commands/metadata_inconsistency_list.go:31

func newMetadataInconsistencyListCmd(ec *cli.ExecutionContext) *cobra.Command {
	opts := &metadataInconsistencyListOptions{
		EC: ec,
	}

	metadataInconsistencyListCmd := &cobra.Command{
		Use:          "list",
		Aliases:      []string{"ls"},
		Short:        "List all inconsistent objects from the Hasura Metadata",
		Long:         "At times, when developing, the Hasura Metadata can become inconsistent. This command can be used to list all inconsistent objects from the Hasura Metadata and allow you to understand why your project's Metadata is in an inconsistent state.",
		SilenceUsage: true,
		RunE: func(cmd *cobra.Command, args []string) error {
			op := genOpName(cmd, "RunE")
			err := opts.run()
			opts.EC.Spinner.Stop()

			if err != nil {
				return errors.E(op, fmt.Errorf("failed to list inconsistent metadata: %w", err))
			}

			if opts.isConsistent {
				opts.EC.Logger.Println("metadata is consistent")
			}

			return nil
		},
	}
	f := metadataInconsistencyListCmd.Flags()
	f.StringVarP(
		&opts.outputFormat,
		"output",
		"o",
		"",
		"select output format for inconsistent metadata objects(Allowed values: json)",
	)

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Verify endpoint and admin secret configuration (config file and env overrides)
  2. Confirm basic API access with `metadata export` — identical failure indicates connectivity/auth, not inconsistency logic
  3. Check server health and logs
  4. Match CLI version to server version for the inconsistency APIs

Example fix

# before
hasura metadata inconsistency list  # failed to list inconsistent metadata
# after
export HASURA_GRAPHQL_ADMIN_SECRET=$SECRET
hasura metadata inconsistency list
Defensive patterns

Strategy: retry

Validate before calling

if _, err := cli.GetCommonMetadataOps(ec).ExportMetadata(); err != nil {
  return fmt.Errorf("cannot reach server for inconsistency list: %w", err)
}

Try / catch

if err := listCmd.Execute(); err != nil {
  if strings.Contains(err.Error(), "failed to list inconsistent metadata") {
    // fix credentials/connectivity, retry
  }
}

Prevention

When it happens

Trigger: Running `metadata inconsistency list` when the underlying server query fails: unreachable endpoint, 401/403 from invalid admin secret, server 5xx, or malformed response from a version-skewed server.

Common situations: Diagnosing a broken metadata state but the CLI itself cannot reach/authenticate to the server; environment variables for endpoint/secret not set in CI; server restarting or crashed while being inspected.

Related errors


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