dagger/dagger · error

local module dep source path %q is absolute

Error message

local module dep source path %q is absolute

What it means

The dependency ref was parsed as a local module source but the string is an absolute filesystem path. Dagger requires local module dependencies to be expressed as paths relative to the parent module's source root so they can be resolved portably across clients and contexts.

Source

Thrown at core/modulesource.go:2145

		ctx,
		NewModuleSourceFS(bk, parentSrc),
		depSrcRef,
		depPin,
	)
	if err != nil {
		return inst, fmt.Errorf("failed to parse dep ref string: %w", err)
	}

	switch parsedDepRef.Kind {
	case ModuleSourceKindLocal:
		if parentSrc == nil {
			// it's okay if there's no parent when the dep is git, but we can't find a local dep relative to nothing
			return inst, fmt.Errorf("local module dep source path %q must be relative to a parent module", depSrcRef)
		}

		if filepath.IsAbs(depSrcRef) {
			// they need to be relative to the parent module's source root
			return inst, fmt.Errorf("local module dep source path %q is absolute", depSrcRef)
		}
		if parentSrc.Workspace.Self() != nil {
			depPath := filepath.Join(parentSrc.SourceRootSubpath, depSrcRef)
			if !filepath.IsLocal(depPath) {
				return inst, fmt.Errorf("local module dep source path %q escapes workspace", depSrcRef)
			}
			selectors := []dagql.Selector{{
				Field: "moduleSource",
				Args: []dagql.NamedInput{
					{Name: "path", Value: dagql.String(filepath.ToSlash(depPath))},
				},
			}}
			if depName != "" {
				selectors = append(selectors, dagql.Selector{
					Field: "withName",
					Args: []dagql.NamedInput{
						{Name: "name", Value: dagql.String(depName)},
					},

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Replace the absolute path with a path relative to the parent module's source root, e.g. "../lib" instead of "/home/me/proj/lib".
  2. If the dep lives outside the repo, either move it into the workspace or publish it to git and reference it by git URL.
  3. Verify dagger.json's dependency "source" fields contain only relative paths.
  4. Commit and test on another machine/OS to catch accidental absolute paths.

Example fix

// dagger.json before
{"dependencies": [{"source": "/home/alice/work/shared-utils"}]}
// after
{"dependencies": [{"source": "../shared-utils"}]}
Defensive patterns

Strategy: validation

Validate before calling

if filepath.IsAbs(depRef) {
    return fmt.Errorf("dependency %q must be a relative path, not absolute", depRef)
}

Prevention

When it happens

Trigger: Declaring a dependency whose source is an absolute path (e.g. "/home/user/proj/lib" or "C:\\lib") in dagger.json or passing one to ModuleSource/ResolveDepToSource, and ParseRefString classifies it as a local ref with filepath.IsAbs true.

Common situations: Copy-pasting an absolute path from the shell into dagger.json; code generators emitting os-specific absolute paths; IDE autocomplete inserting full paths when adding a dependency.

Related errors


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