{"record":{"id":"88e5dc45cdf6afc7","repo":"hasura/graphql-engine","slug":"cannot-clear-metadata-w","errorCode":null,"errorMessage":"cannot clear Metadata: %w","messagePattern":"cannot clear Metadata: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/metadata_clear.go","lineNumber":70,"sourceCode":"\n\treturn metadataResetCmd\n}\n\ntype MetadataClearOptions struct {\n\tEC *cli.ExecutionContext\n}\n\nfunc (o *MetadataClearOptions) Run() error {\n\tvar (\n\t\top  errors.Op = \"commands.MetadataClearOptions.Run\"\n\t\terr error\n\t)\n\n\tmetadataHandler := projectmetadata.NewHandlerFromEC(o.EC)\n\n\terr = metadataHandler.ResetMetadata()\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"cannot clear Metadata: %w\", err))\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":52,"sourceCodeEnd":75,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/metadata_clear.go#L52-L75","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Shell: ensure you are in a valid project\ntest -f config.yaml || { echo 'not a hasura project'; exit 1; }\nhasura metadata clear","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run metadata commands from the project root with intact config.yaml","Keep server credentials in sync with the project environment"],"tags":["metadata-clear","project-config","hasura-api"],"backgroundTag":"metadata-clear-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}