{"record":{"id":"16ee941873fc23cd","repo":"hasura/graphql-engine","slug":"failed-to-reload-metadata-w","errorCode":null,"errorMessage":"failed to reload metadata: %w","messagePattern":"failed to reload metadata: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/metadata_reload.go","lineNumber":59,"sourceCode":"\t\t},\n\t}\n\n\treturn metadataReloadCmd\n}\n\ntype MetadataReloadOptions struct {\n\tEC *cli.ExecutionContext\n}\n\nfunc (o *MetadataReloadOptions) runWithInfo() error {\n\tvar op errors.Op = \"commands.MetadataReloadOptions.runWithInfo\"\n\n\to.EC.Spin(\"Reloading metadata...\")\n\terr := o.run()\n\to.EC.Spinner.Stop()\n\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"failed to reload metadata: %w\", err))\n\t}\n\n\to.EC.Logger.Info(\"Metadata reloaded\")\n\ticListOpts := &metadataInconsistencyListOptions{\n\t\tEC: o.EC,\n\t}\n\n\terr = icListOpts.read(projectmetadata.NewHandlerFromEC(icListOpts.EC))\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"failed to read metadata status: %w\", err))\n\t}\n\n\tif icListOpts.isConsistent {\n\t\ticListOpts.EC.Logger.Infoln(\"Metadata is consistent\")\n\t} else {\n\t\ticListOpts.EC.Logger.Warnln(\n\t\t\t\"Metadata is inconsistent, use 'hasura metadata ic list' command to see the inconsistent objects\",\n\t\t)","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/metadata_reload.go#L41-L77","documentation":"The `metadata reload` command asks the server to reload its metadata from its datastore, then runs the operation (o.run()) with a spinner. This error means the reload call itself failed — the server rejected the request, could not reload, or the connection failed. Note reload executes server-side: it re-reads the server's own metadata, not your local file.","triggerScenarios":"Running `metadata reload` when the server's reload_metadata API call errors: auth failure, network error, server unable to reload because its datastore is unreachable, or a server bug during reload.","commonSituations":"Reloading after applying metadata when the server's backing datastore connection is broken; insufficient permissions; server in a bad state where reload triggers an internal error; running reload against a read-only or paused instance.","solutions":["Check the wrapped error for the exact server response (auth vs internal error)","Verify the server's datastore connectivity from the server's perspective (server logs)","Confirm admin secret permissions include metadata reload","If reload consistently fails, restart the server and retry, or re-apply a known-good metadata file"],"exampleFix":"# before\nhasura metadata reload  # failed to reload metadata\n# after\n# check server logs for reload errors, then:\nhasura metadata reload","handlingStrategy":"retry","validationCode":"// confirm server is healthy before reload\nresp, err := http.Get(endpoint + \"/healthz\")\nif err != nil || resp.StatusCode != 200 {\n  return errors.New(\"server unhealthy; reload likely to fail\")\n}","typeGuard":null,"tryCatchPattern":"if err := reloadCmd.Execute(); err != nil {\n  if strings.Contains(err.Error(), \"failed to reload metadata\") {\n    // inspect server logs, verify datastore connectivity, retry after delay\n  }\n}","preventionTips":["Check server health before reload in scripts","Ensure the server's datastore is reachable from the server","Keep a known-good exported metadata file as a restore point"],"tags":["metadata","reload","server-api","cli","go"],"backgroundTag":"metadata-reload-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}