{"record":{"id":"b3b4c07bbfbca31b","repo":"hashicorp/packer","slug":"failed-to-initialize-version-for-fingerprint-s","errorCode":null,"errorMessage":"failed to initialize version for fingerprint %s: %s","messagePattern":"failed to initialize version for fingerprint (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/hcp/registry/types.bucket.go","lineNumber":481,"sourceCode":"\n\tlog.Println(\n\t\t\"[TRACE] a valid version for build was created with the Id\", createVersionResp.Payload.Version.ID,\n\t)\n\treturn createVersionResp.Payload.Version, nil\n}\n\nfunc (bucket *Bucket) initializeVersion(\n\tctx context.Context, templateType hcpPackerModels.HashicorpCloudPacker20230101TemplateType,\n) error {\n\t// load existing version using fingerprint.\n\tversion, err := bucket.client.GetVersion(ctx, bucket.Name, bucket.Version.Fingerprint)\n\tif hcpPackerAPI.CheckErrorCode(err, codes.Aborted) {\n\t\t// probably means Version doesn't exist need a way to check the error\n\t\tversion, err = bucket.createVersion(templateType)\n\t}\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to initialize version for fingerprint %s: %s\", bucket.Version.Fingerprint, err)\n\t}\n\n\tif version == nil {\n\t\treturn fmt.Errorf(\"failed to initialize version details for Bucket %s with error: %w\", bucket.Name, err)\n\t}\n\n\tif version.TemplateType != nil &&\n\t\t*version.TemplateType != hcpPackerModels.HashicorpCloudPacker20230101TemplateTypeTEMPLATETYPEUNSET &&\n\t\t*version.TemplateType != templateType {\n\t\treturn fmt.Errorf(\n\t\t\t\"This version was initially created with a %[2]s template. \"+\n\t\t\t\t\"Changing from %[2]s to %[1]s is not supported\",\n\t\t\ttemplateType, *version.TemplateType,\n\t\t)\n\t}\n\n\tlog.Println(\n\t\t\"[TRACE] a valid version was retrieved with the id\", version.ID,","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/internal/hcp/registry/types.bucket.go#L463-L499","documentation":"HCP registry error from Bucket.initializeVersion: resolving the build's version by fingerprint failed — the lookup for an existing version and the attempt to create a new one both errored. The wrapped cause is the HCP API error.","triggerScenarios":"Thrown at internal/hcp/registry/types.bucket.go:481 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check HCP service status and credentials, then retry the build","Verify the bucket fingerprint is not corrupted (custom HCP_PACKER_BUCKET_FINGERPRINT values)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}