rancher/rancher · error

unable to create temp file for storing the oci artifact

Error message

unable to create temp file for storing the oci artifact

What it means

Error "unable to create temp file for storing the oci artifact" thrown in rancher/rancher.

Source

Thrown at pkg/catalogv2/oci/client.go:178

	if manifest.MediaType != ocispecv1.MediaTypeImageManifest {
		return "", fmt.Errorf("the oci artifact %s is not a helm chart. The OCI URL must contain only helm charts", ociURL)
	}

	// Fetch the manifest blob of the oci artifact
	manifestblob, err := content.FetchAll(ctx, memoryStore, manifest)
	if err != nil {
		return "", fmt.Errorf("unable to fetch the manifest blob of %s: %w", ociURL, err)
	}
	var manifestJSON ocispecv1.Manifest
	err = json.Unmarshal(manifestblob, &manifestJSON)
	if err != nil {
		return "", fmt.Errorf("unable to unmarshal manifest blob of %s: %w", ociURL, err)
	}

	// Create a temp file to store the helm chart tar
	tempFile, err := os.CreateTemp("", "helm-")
	if err != nil {
		return "", fmt.Errorf("unable to create temp file for storing the oci artifact")
	}

	// Checking if the OCI artifact is of type helm config ?
	if manifestJSON.ArtifactType == helmregistry.ConfigMediaType || manifestJSON.Config.MediaType == helmregistry.ConfigMediaType {
		// find the layer of helm chart type and fetch it
		for _, layer := range manifestJSON.Layers {
			if layer.MediaType == helmregistry.ChartLayerMediaType {
				chartTar, err := content.FetchAll(ctx, memoryStore, layer)
				if err != nil {
					return "", fmt.Errorf("unable to fetch chart blob of %s: %w", ociURL, err)
				}

				err = os.WriteFile(tempFile.Name(), chartTar, 0o600)
				if err != nil {
					return "", fmt.Errorf("unable to write chart %s into file %s: %w", ociURL, tempFile.Name(), err)
				}

				return tempFile.Name(), nil

View on GitHub (pinned to 932558d4e6)

When it happens

Trigger: Thrown at pkg/catalogv2/oci/client.go:178 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rancher/rancher@932558d4e6 (2026-08-16). Data as JSON: /api/errors/b7f6f25f0c530023. Report an issue: GitHub.