{"record":{"id":"85e53cecae02b264","repo":"pulumi/pulumi","slug":"request-to-signal-completion-of-the-publish-operat","errorCode":null,"errorMessage":"Request to signal completion of the publish operation failed: %w","messagePattern":"Request to signal completion of the publish operation failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/backend/httpstate/client/client.go","lineNumber":2092,"sourceCode":"\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed to upload compressed PolicyPack: %w\", err)\n\t}\n\n\t//\n\t// Step 3: Signal to the service that the PolicyPack publish operation is complete.\n\t//\n\n\t// If the version tag is empty, an older version of pulumi/policy is being used and\n\t// we therefore need to use the version provided by the pulumi service.\n\tversion := analyzerInfo.Version\n\tif version == \"\" {\n\t\tversion = strconv.Itoa(resp.Version)\n\t\tfmt.Printf(\"Published as version %s\\n\", version)\n\t}\n\terr = pc.restCall(ctx, \"POST\",\n\t\tpublishPolicyPackPublishComplete(orgName, analyzerInfo.Name, version), nil, nil, nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Request to signal completion of the publish operation failed: %w\", err)\n\t}\n\n\treturn version, nil\n}\n\n// convertPolicyConfigSchema converts a policy's schema from the analyzer to the apitype.\nfunc convertPolicyConfigSchema(schema *plugin.AnalyzerPolicyConfigSchema) (*apitype.PolicyConfigSchema, error) {\n\tif schema == nil {\n\t\treturn nil, nil\n\t}\n\tproperties := map[string]*json.RawMessage{}\n\tfor k, v := range schema.Properties {\n\t\tbytes, err := json.Marshal(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\traw := json.RawMessage(bytes)\n\t\tproperties[k] = &raw","sourceCodeStart":2074,"sourceCodeEnd":2110,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/backend/httpstate/client/client.go#L2074-L2110","documentation":"This error wraps failure of Step 3 of publishing a policy pack: POST to the publish-complete endpoint, which tells the service the archive upload finished and finalizes the published version. Thrown when restCall fails on this final signal call — auth problems, malformed version in the path, or network/5xx errors.","triggerScenarios":"Calling the completion endpoint after upload with an invalid version string in the URL (e.g. empty version when the service didn't return one), an expired session/token mid-publish, or transient network/5xx failures.","commonSituations":"CI jobs where the token rotates or expires during a long upload; older service behavior returning no version so the path is built with an empty/invalid version; pack uploaded but never finalized leaving it in a pending state.","solutions":["Retry the whole publish operation — the pack may be stuck in a pending state otherwise.","Verify the version value used in publishPolicyPackPublishComplete is non-empty and numeric.","Check token validity (`pulumi whoami`) if the publish is long-running.","Inspect the wrapped HTTP status: 4xx → bad version/org/name in path, 5xx → retry."],"exampleFix":"// before\nerr = pc.restCall(ctx, \"POST\",\n\tpublishPolicyPackPublishComplete(orgName, analyzerInfo.Name, version), nil, nil, nil)\nif err != nil { return \"\", fmt.Errorf(\"Request to signal completion of the publish operation failed: %w\", err) }\n// after\nif version == \"\" { version = \"latest\" } // or fail fast before building the path\nerr = pc.restCall(ctx, \"POST\",\n\tpublishPolicyPackPublishComplete(orgName, analyzerInfo.Name, version), nil, nil, nil)\nif err != nil {\n\treturn \"\", fmt.Errorf(\"signaling publish completion for %s@%s failed; the pack may need republishing: %w\", analyzerInfo.Name, version, err)\n}","handlingStrategy":"try-catch","validationCode":"// ensure a version exists before signaling completion\nif version == \"\" {\n\treturn errors.New(\"no version returned by publish; cannot signal completion\")\n}\nif _, err := strconv.Atoi(version); err != nil {\n\treturn fmt.Errorf(\"non-numeric version %q in completion path\", version)\n}","typeGuard":null,"tryCatchPattern":"err = pc.restCall(ctx, \"POST\",\n\tpublishPolicyPackPublishComplete(orgName, analyzerInfo.Name, version), nil, nil, nil)\nif err != nil {\n\t// the pack may be pending; safest recovery is to republish\n\treturn \"\", fmt.Errorf(\"completion signal failed for %s@%s; republish the pack: %w\", analyzerInfo.Name, version, err)\n}","preventionTips":["Fail fast if the service returned no version before building the completion path.","Use long-lived CI tokens so auth doesn't lapse between upload and completion.","On failure, republish the whole pack — partial publishes leave it pending.","Check the wrapped HTTP status to separate bad-path errors (4xx) from transient ones (5xx)."],"tags":["http","pulumi-cloud","policy-pack","publish"],"backgroundTag":"policy-pack-publish-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}