{"record":{"id":"05c1f69d561e7627","repo":"hasura/graphql-engine","slug":"error-while-fetching-catalog-state-w","errorCode":null,"errorMessage":"error while fetching catalog state: %w","messagePattern":"error while fetching catalog state: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/internal/scripts/update-project-v3.go","lineNumber":431,"sourceCode":"\tif err := srcSettingsStore.PrepareSettingsDriver(); err != nil {\n\t\treturn errors.E(op, err)\n\t}\n\n\tdstSettingsStore := settings.NewStateStoreCatalog(\n\t\tstatestore.NewCLICatalogState(ec.APIClient.V1Metadata),\n\t)\n\tif err := dstSettingsStore.PrepareSettingsDriver(); err != nil {\n\t\treturn errors.E(op, err)\n\t}\n\n\terr = statestore.CopySettingsState(srcSettingsStore, dstSettingsStore)\n\tif err != nil {\n\t\treturn errors.E(op, err)\n\t}\n\n\tcliState, err := statestore.NewCLICatalogState(ec.APIClient.V1Metadata).Get()\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"error while fetching catalog state: %w\", err))\n\t}\n\n\tcliState.IsStateCopyCompleted = true\n\tif _, err := statestore.NewCLICatalogState(ec.APIClient.V1Metadata).Set(*cliState); err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"cannot set catalog state: %w\", err))\n\t}\n\n\treturn nil\n}\n\nfunc CheckIfUpdateToConfigV3IsRequired(ec *cli.ExecutionContext) error {\n\tvar op errors.Op = \"scripts.CheckIfUpdateToConfigV3IsRequired\"\n\t// see if an update to config V3 is necessary\n\tif ec.Config.Version <= cli.V1 && ec.HasMetadataV3 {\n\t\tec.Logger.Info(\"config v1 is deprecated from v1.4\")\n\n\t\treturn errors.E(\n\t\t\top,","sourceCodeStart":413,"sourceCodeEnd":449,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/internal/scripts/update-project-v3.go#L413-L449","documentation":"CopyState, part of the v3 upgrade flow, failed to read the CLI catalog state via statestore.NewCLICatalogState(ec.APIClient.V1Metadata).Get() — i.e. fetching the hdb_catalog 'cli_state' metadata row from the Hasura server failed.","triggerScenarios":"Running the state-copy step of `hasura scripts update-project-v3` (or CopyState directly) when the Hasura GraphQL engine is unreachable, the API errors, or the metadata API request fails.","commonSituations":"Server not running / wrong endpoint in config, auth (admin secret) mismatch, network issues, or an incompatible server version lacking the statestore metadata APIs.","solutions":["Verify the Hasura server is running and the endpoint/admin secret in config are correct","Check server logs for the failed v1metadata request and resolve the API error","Retry the update script once connectivity is restored","Ensure server version supports config v3 state APIs (>= 1.4 series)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if err := ec.APIClient.V1MetadataCommon; err != nil { /* verify server reachable */ }\n// preflight: hit /healthz before running the state copy\nif resp, err := http.Get(endpoint + \"/healthz\"); err != nil || resp.StatusCode != 200 {\n    return fmt.Errorf(\"server not healthy\")\n}","typeGuard":null,"tryCatchPattern":"if err := scripts.CopyState(ec); err != nil {\n    if strings.Contains(err.Error(), \"fetching catalog state\") { /* wait, verify endpoint/admin secret, retry */ }\n}","preventionTips":["Health-check the server before running scripts update-project-v3","Pin matching CLI and server versions","Keep admin secret consistent across the run"],"tags":["network","hasura-metadata-api","state-store","config-v3-migration"],"backgroundTag":"metadata-api-request-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}