{"record":{"id":"11f481846fd00052","repo":"hasura/graphql-engine","slug":"cannot-set-catalog-state-w","errorCode":null,"errorMessage":"cannot set catalog state: %w","messagePattern":"cannot set catalog state: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/internal/scripts/update-project-v3.go","lineNumber":436,"sourceCode":"\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,\n\t\t\tfmt.Errorf(\n\t\t\t\t\"%s\",\n\t\t\t\t\"please upgrade your project to a newer version.\\nuse \"+color.New(color.FgCyan).\n\t\t\t\t\tSprintFunc()(\n\t\t\t\t\t\"hasura scripts update-project-v2\",","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/internal/scripts/update-project-v3.go#L418-L454","documentation":"CopyState successfully fetched the catalog state but failed persisting it back with IsStateCopyCompleted=true via statestore.NewCLICatalogState(...).Set(...) (a v1metadata replace_metadata-style call).","triggerScenarios":"The Set API call errors: server rejects the metadata, times out, or disconnects between the Get and Set calls of the state copy step.","commonSituations":"Transient network drop mid-upgrade, admin secret rotated between calls, server restarting, or corrupted state metadata that the server refuses to write.","solutions":["Retry the update script — the state copy is idempotent-ish (Get then Set)","Check server connectivity and admin secret, then re-run","Inspect server logs for the rejected metadata write and fix the reported cause","If state is corrupted, follow docs to reset cli_state in hdb_catalog before retrying"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt := 0; attempt < 3; attempt++ {\n    if err := scripts.CopyState(ec); err == nil { break } else if !strings.Contains(err.Error(), \"cannot set catalog state\") { return err }\n    time.Sleep(time.Second * time.Duration(attempt+1))\n}","preventionTips":["The Get-then-set copy is safe to retry","Stabilize network/admin secret before retrying"],"tags":["network","hasura-metadata-api","state-store","retryable"],"backgroundTag":"metadata-api-write-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}