{"record":{"id":"b7f6f25f0c530023","repo":"rancher/rancher","slug":"unable-to-create-temp-file-for-storing-the-oci-art","errorCode":null,"errorMessage":"unable to create temp file for storing the oci artifact","messagePattern":"unable to create temp file for storing the oci artifact","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/catalogv2/oci/client.go","lineNumber":178,"sourceCode":"\tif manifest.MediaType != ocispecv1.MediaTypeImageManifest {\n\t\treturn \"\", fmt.Errorf(\"the oci artifact %s is not a helm chart. The OCI URL must contain only helm charts\", ociURL)\n\t}\n\n\t// Fetch the manifest blob of the oci artifact\n\tmanifestblob, err := content.FetchAll(ctx, memoryStore, manifest)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to fetch the manifest blob of %s: %w\", ociURL, err)\n\t}\n\tvar manifestJSON ocispecv1.Manifest\n\terr = json.Unmarshal(manifestblob, &manifestJSON)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to unmarshal manifest blob of %s: %w\", ociURL, err)\n\t}\n\n\t// Create a temp file to store the helm chart tar\n\ttempFile, err := os.CreateTemp(\"\", \"helm-\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to create temp file for storing the oci artifact\")\n\t}\n\n\t// Checking if the OCI artifact is of type helm config ?\n\tif manifestJSON.ArtifactType == helmregistry.ConfigMediaType || manifestJSON.Config.MediaType == helmregistry.ConfigMediaType {\n\t\t// find the layer of helm chart type and fetch it\n\t\tfor _, layer := range manifestJSON.Layers {\n\t\t\tif layer.MediaType == helmregistry.ChartLayerMediaType {\n\t\t\t\tchartTar, err := content.FetchAll(ctx, memoryStore, layer)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", fmt.Errorf(\"unable to fetch chart blob of %s: %w\", ociURL, err)\n\t\t\t\t}\n\n\t\t\t\terr = os.WriteFile(tempFile.Name(), chartTar, 0o600)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", fmt.Errorf(\"unable to write chart %s into file %s: %w\", ociURL, tempFile.Name(), err)\n\t\t\t\t}\n\n\t\t\t\treturn tempFile.Name(), nil","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/rancher/rancher/blob/932558d4e68565aff2d2f36e89ec4a391b06e7c5/pkg/catalogv2/oci/client.go#L160-L196","documentation":"Error \"unable to create temp file for storing the oci artifact\" thrown in rancher/rancher.","triggerScenarios":"Thrown at pkg/catalogv2/oci/client.go:178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"932558d4e68565aff2d2f36e89ec4a391b06e7c5","analyzedAt":"2026-08-16T04:37:02.125Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}