hasura/graphql-engine · error
cannot clear Metadata: %w
Error message
cannot clear Metadata: %w
What it means
Returned when projectmetadata.Handler.ResetMetadata fails while clearing metadata. This variant goes through the project metadata handler, which resolves the metadata format from the project config and issues the reset. The wrapped error can be either a local failure (reading the project's metadata files, unsupported config) or a server API failure.
Source
Thrown at cli/commands/metadata_clear.go:70
return metadataResetCmd
}
type MetadataClearOptions struct {
EC *cli.ExecutionContext
}
func (o *MetadataClearOptions) Run() error {
var (
op errors.Op = "commands.MetadataClearOptions.Run"
err error
)
metadataHandler := projectmetadata.NewHandlerFromEC(o.EC)
err = metadataHandler.ResetMetadata()
if err != nil {
return errors.E(op, fmt.Errorf("cannot clear Metadata: %w", err))
}
return nil
}
View on GitHub (pinned to 724551b9ae)
Solutions
- Run inside a valid Hasura project directory with an intact config.yaml
- Check the wrapped error: if it mentions the API, verify endpoint/admin-secret and server reachability
- If config-related, re-initialize the project (hasura init) or fix config.yaml version/settings
- Ensure CLI and server versions are compatible
Defensive patterns
Strategy: validation
Validate before calling
# Shell: ensure you are in a valid project
test -f config.yaml || { echo 'not a hasura project'; exit 1; }
hasura metadata clear Prevention
- Run metadata commands from the project root with intact config.yaml
- Keep server credentials in sync with the project environment
When it happens
Trigger: Running `hasura metadata clear` in a project directory where the handler cannot reset metadata: the server rejects the request (auth/connectivity), or the project config/metadata state prevents building a valid reset operation.
Common situations: Running the command outside a Hasura project or with a corrupted config.yaml, pointing at a server with an expired/rotated admin secret, or config version mismatches between the project and server.
Related errors
- failed to clear metadata: %w
- applying data sources failed: %s
- failed to export metadata: %w
- failed to export metadata: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/88e5dc45cdf6afc7.
Report an issue: GitHub.