dagger/dagger · error

select latest image tag for %q: %w

Error message

select latest image tag for %q: %w

What it means

Raised when Dagger resolves a floating image reference (e.g. 'alpine:latest' or a bare image name) in Container.from and core.SelectLatestContainerTag fails to pick a tag from the list returned by the registry. This wrapping error indicates the registry returned tags but none could be selected as the latest, typically because the tag list was empty or unparseable. It preserves the underlying cause (e.g. 'no tags found') via %w.

Source

Thrown at core/schema/container.go:1316

			defer detach()

			listCtx, span := core.Tracer(ctx).Start(
				ctx,
				fmt.Sprintf("select latest release for %s", refName.String()),
				telemetry.Internal(),
				telemetry.Encapsulate(),
			)
			tags, err := rslvr.ListImageTags(listCtx, refName.String(), serverresolver.ListImageTagsOpts{
				Network:           network,
				RegistryTransport: registryTransport,
			})
			telemetry.EndWithCause(span, &err)
			if err != nil {
				return inst, fmt.Errorf("failed to list image tags for %q: %w", refName.String(), err)
			}
			selectedTag, err = core.SelectLatestContainerTag(tags)
			if err != nil {
				return inst, fmt.Errorf("select latest image tag for %q: %w", refName.String(), err)
			}
			if latestResolution.ShouldWrite && lookupLock != nil {
				if err := lookupLock.SetLookup(
					workspace.CoreLockNamespace,
					workspace.LockOperationOCILatest,
					latestInputs,
					selectedTag,
				); err != nil {
					return inst, fmt.Errorf("set lock entry for %s: %w", workspace.LockOperationOCILatest, err)
				}
			}
		}
		refName, err = reference.WithTag(refName, selectedTag)
		if err != nil {
			return inst, fmt.Errorf("apply selected image tag %q: %w", selectedTag, err)
		}
	}

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Verify the image repository actually has published tags by checking it in the registry UI or with `crane ls <repo>`
  2. Pin the image to an explicit tag (e.g. 'alpine:3.20') so the latest-tag selection path is skipped entirely
  3. Check dagger.lock for a stale/empty oci.latest entry and remove it to force re-resolution
  4. If the registry forbids tag listing APIs, use an explicit tag or digest reference instead

Example fix

// before
ctr := dag.Container().From("myrepo/myapp")
// after
ctr := dag.Container().From("myrepo/myapp:v1.2.3")
Defensive patterns

Strategy: validation

Validate before calling

// Prefer explicit tags; check the repo has tags before using a floating ref
tags, err := crane.ListTags("myrepo/myapp") // or inspect registry UI
if err != nil || len(tags) == 0 {
    return fmt.Errorf("repo has no tags; pin an explicit tag")
}

Prevention

When it happens

Trigger: Calling Container.from with a tag-less or 'latest'-style reference whose lock file has no pin, where ListImageTags returns a set of tags from which SelectLatestContainerTag cannot determine a latest tag (empty list, or no tags matching semver/version heuristics).

Common situations: Referencing a private or obscure image repository that exists but publishes no listing of tags (some registries restrict tag listing); referencing a repository that has been emptied of tags; mistyping a repository name so an empty mirror repo is queried.

Related errors


AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05). Data as JSON: /api/errors/12bd6318519670fe. Report an issue: GitHub.