dagger/dagger · error

%s only supports remote workspaces or local git workspaces;

Error message

%s only supports remote workspaces or local git workspaces; selected workspace is %s: %w

What it means

Same resolution failure as the "requires -W" case, but raised when the user DID select a workspace address that is not a parseable remote workspace address and also cannot be projected onto a local git workspace. The error names the selected workspace and states that only remote workspaces or local git workspaces are supported.

Source

Thrown at internal/cmd/dagger/workspace.go:859

func selectedRemoteWorkspaceAddress(ctx context.Context, command string) (workspaceRemoteAddress, string, error) {
	address := strings.TrimSpace(workspaceRef)
	if address != "" {
		remote, ok, err := parseWorkspaceRemoteAddress(ctx, address)
		if err != nil {
			return workspaceRemoteAddress{}, "", err
		}
		if ok {
			return remote, address, nil
		}
	}

	remote, inferred, err := inferLocalWorkspaceRemoteAddress(ctx, address)
	if err != nil {
		if address == "" {
			return workspaceRemoteAddress{}, "", fmt.Errorf("%s requires a remote workspace selected with -W or a local workspace with git origin: %w", command, err)
		}
		return workspaceRemoteAddress{}, "", fmt.Errorf("%s only supports remote workspaces or local git workspaces; selected workspace is %s: %w", command, address, err)
	}
	return remote, inferred, nil
}

type localWorkspaceRemoteInfo struct {
	repoRoot      string
	cloneRef      string
	workspacePath string
}

func localWorkspaceRemoteInfoForAddress(ctx context.Context, address string) (localWorkspaceRemoteInfo, error) {
	localPath := address
	if localPath == "" {
		localPath = "."
	}
	if parsed, err := url.Parse(localPath); err == nil && parsed.Scheme == "file" {
		localPath = parsed.Path
	}

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Correct the selected workspace address to a valid remote workspace address (e.g. a GitHub repo URL).
  2. If a local checkout was intended, ensure the path is a git repository with a remote origin.
  3. Run `git rev-parse --show-toplevel` and `git config --get remote.origin.url` in the target path to verify it qualifies.

Example fix

// before
dagger cloud check list -W ./not-a-repo

// after
dagger cloud check list -W github.com/org/repo
Defensive patterns

Strategy: validation

Validate before calling

if _, _, err := parseWorkspaceAddressFlag(wsAddr); err != nil {
    // selected value is neither a remote address nor a git path: fix before invoking
}

Try / catch

if err := runCmd(); err != nil {
    if strings.Contains(err.Error(), "only supports remote workspaces or local git workspaces") {
        // fall back to the canonical remote address
        return runCmdWithAddress(canonicalRemoteAddress)
    }
    return err
}

Prevention

When it happens

Trigger: selectedRemoteWorkspaceAddress called with a non-empty workspaceRef that fails parseWorkspaceRemoteAddress, and inferLocalWorkspaceRemoteAddress on that address also errors — e.g. a typo'd path, a bare local directory without git, or a malformed workspace string.

Common situations: Typo in the -W value so it neither parses as a remote address nor exists as a git path; passing a plain folder name that isn't a git repo; pointing at a repo clone without an origin remote.

Related errors


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