dagger/dagger · error

compat workspace is required

Error message

compat workspace is required

What it means

Input guard in PlanMigration: compatWorkspace (or its Config) is nil. The migration planner needs a parsed legacy dagger.json to plan from; a nil argument is programmer/caller error, not a config problem.

Source

Thrown at core/workspace/migrate.go:158

	WorkspaceConfigData      []byte
	MigratedModuleConfigData []byte
	MigratedModuleConfigPath string
	MigrationReportData      []byte
}

// PlanMigration computes the pure filesystem plan for migrating a compat
// workspace into workspace format. workspaceRoot is the workspace boundary:
// when the legacy config lives below it, the plan is "hoisted" — nested
// dagger.toml files are never created, so the config's workspace fields
// (toolchains) are installed into a dagger.toml at the workspace root with
// their local sources rebased, while the module config still converts in
// place at its own directory and the module itself is not installed.
//
// When the config has an SDK, its toolchains are also recorded as
// dependencies of the migrated module config (see buildMigratedModuleConfig).
func PlanMigration(compatWorkspace *CompatWorkspace, workspaceRoot string) (*MigrationPlan, error) {
	if compatWorkspace == nil || compatWorkspace.Config == nil {
		return nil, fmt.Errorf("compat workspace is required")
	}
	if compatWorkspace.ProjectRoot == "" {
		return nil, fmt.Errorf("compat workspace project root is required")
	}
	if compatWorkspace.ConfigPath == "" {
		return nil, fmt.Errorf("compat workspace config path is required")
	}
	if workspaceRoot == "" {
		workspaceRoot = compatWorkspace.ProjectRoot
	}

	cfg := compatWorkspace.Config
	if !mustMigrateToWorkspaceConfig(cfg) {
		return nil, fmt.Errorf("dagger.json does not require workspace config migration")
	}

	moduleRoot := compatWorkspace.ProjectRoot
	hoistRel, err := filepath.Rel(filepath.Clean(workspaceRoot), filepath.Clean(moduleRoot))

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Load and parse the legacy workspace before planning migration
  2. Check the CompatWorkspace construction path for nil results
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/workspace/migrate.go:158 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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