dagger/dagger · error

workspace host path is required

Error message

workspace host path is required

What it means

workspaceMigrationParentAssignments computes which compat workspaces get a parent plan, and requires a concrete local workspace (non-nil, with a non-empty HostPath) because parent assignments are local-path based. This error means the function was invoked with no local workspace host path, so relative parent paths cannot be computed.

Source

Thrown at core/schema/workspace_migrate_parent.go:52

	if err != nil {
		return nil, err
	}
	parentPlans, err := workspaceMigrationParentPlans(ws, assignments, workspacePlans)
	if err != nil {
		return nil, err
	}
	if parentPlans, err = workspaceMigrationInstallParentSDKModules(workspacePlans, parentPlans, assignments); err != nil {
		return nil, err
	}
	return workspaceMigrationWarnExplicitModuleLoading(ws, workspacePlans, parentPlans, assignments)
}

func workspaceMigrationParentAssignments(
	ws *core.Workspace,
	compatWorkspaces []*workspace.CompatWorkspace,
) ([]workspaceMigrationParentAssignment, error) {
	if ws == nil || ws.HostPath() == "" {
		return nil, fmt.Errorf("workspace host path is required")
	}

	assignments := make([]workspaceMigrationParentAssignment, 0, len(compatWorkspaces))
	for _, compatWorkspace := range compatWorkspaces {
		if compatWorkspace == nil {
			continue
		}
		// A discovered local dependency/toolchain target is loaded through its
		// referrer, not explicitly; it must not create a parent workspace, hoist
		// its runtime, or warn about explicit loading.
		if compatWorkspace.DiscoveredLocalModule {
			continue
		}
		if compatWorkspace.Config == nil || compatWorkspace.Config.SDK == nil {
			continue
		}
		rel, err := workspaceMigrationProjectRootRelPath(ws, compatWorkspace.ProjectRoot)
		if err != nil {

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Ensure the workspace is materialized locally with a valid HostPath before parent planning
  2. Check that workspace discovery succeeded and returned a non-nil workspace
  3. Skip parent-plan flow for non-local workspaces; run the local-only migration path instead
  4. Verify ws.HostPath() is set after workspace load

Example fix

// before
plans, err := workspaceMigrationParentPlansForPlainModules(remoteWS, cw)
// after
if remoteWS.HostPath() == "" {
    return fmt.Errorf("migration requires a local workspace")
}
plans, err := workspaceMigrationParentPlansForPlainModules(localWS, cw)
Defensive patterns

Strategy: validation

Validate before calling

if ws == nil || ws.HostPath() == "" {
    return fmt.Errorf("parent assignment requires a locally materialized workspace")
}

Type guard

func isLocalWorkspace(ws *core.Workspace) bool {
    return ws != nil && ws.HostPath() != ""
}

Try / catch

plans, err := workspaceMigrationParentPlansForPlainModules(ws, cws)
if err != nil {
    if strings.Contains(err.Error(), "workspace host path is required") {
        return fmt.Errorf("migration requires a local checkout; materialize the workspace first: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling workspaceMigrationParentPlansForPlainModules with a nil ws or a remote/virtual workspace whose HostPath() returns "" (e.g. workspace never materialized locally).

Common situations: Running migration for a remote or in-memory workspace where local checkout is absent; regression where ws is nil due to earlier failed discovery; invoking parent-plan machinery outside the normal local migrate flow.

Related errors


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