dagger/dagger · error

unknown module source kind: %s

Error message

unknown module source kind: %s

What it means

While checking whether an update request matches a local-kind item, the code needs the parent's context root and switches on parentSrc.Self().Kind. Only local and git parents are handled; any other parent kind (e.g. dir) hits the default branch and throws 'unknown module source kind'.

Source

Thrown at core/schema/modulesource.go:1786

			}
			newUpdatedArgs = append(newUpdatedArgs, dagql.NewID[*core.ModuleSource](updatedItemID))
			continue
		}

		if existingItem.Self().Kind == core.ModuleSourceKindLocal {
			for updateReq := range updateReqs {
				if updateReq.symbolic == existingItem.Self().ModuleName {
					return nil, fmt.Errorf("updating local %s is not supported", accessor.typ.Plural())
				}

				var contextRoot string
				switch parentSrc.Self().Kind {
				case core.ModuleSourceKindLocal:
					contextRoot = parentSrc.Self().Local.ContextDirectoryPath
				case core.ModuleSourceKindGit:
					contextRoot = "/"
				default:
					return nil, fmt.Errorf("unknown module source kind: %s", parentSrc.Self().Kind)
				}

				parentSrcRoot := filepath.Join(contextRoot, parentSrc.Self().SourceRootSubpath)
				itemSrcRoot := filepath.Join(contextRoot, existingItem.Self().SourceRootSubpath)
				existingSymbolic, err := pathutil.LexicalRelativePath(parentSrcRoot, itemSrcRoot)
				if err != nil {
					return nil, fmt.Errorf("failed to get relative path: %w", err)
				}

				if updateReq.symbolic == existingSymbolic {
					return nil, fmt.Errorf("updating local %s is not supported", accessor.typ.Plural())
				}
			}
			continue
		}

		existingName := existingItem.Self().ModuleName
		existingSymbolic := existingItem.Self().Git.CloneRef

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Update dependencies using a local (in-workspace) or git-resolved module source instead of a dir-kind source.
  2. Load the module via the normal workspace/develop flow so the parent source kind is local or git.
  3. Update dagger if dir-kind parents should be supported — this may be a missing-case gap.
  4. As a workaround, edit the dependency version directly in dagger.json instead of calling updateDependencies.

Example fix

// before: updating deps of a dir-kind source
ctxDir.ModuleSource().UpdateDependencies(ctx, ["dep"])
// after: use the workspace-local source
localSrc.UpdateDependencies(ctx, ["dep"])
Defensive patterns

Strategy: validation

Validate before calling

// Go: only update deps on local or git parent sources
switch parent.Self().Kind {
case core.ModuleSourceKindLocal, core.ModuleSourceKindGit:
    // ok
default:
    return fmt.Errorf("cannot update dependencies of %s-kind source %q; use local or git source", parent.Self().Kind, parent.Self().ModuleName)
}

Type guard

func canUpdateDeps(src *core.ModuleSource) bool {
    return src.Kind == core.ModuleSourceKindLocal || src.Kind == core.ModuleSourceKindGit
}

Prevention

When it happens

Trigger: Calling updateDependencies/updateToolchains on a module whose parent source Kind is dir (or any non-local/non-git kind) while a local-kind related module exists and at least one update request is being matched.

Common situations: Updating dependencies of a module loaded from a Directory-style (dir-kind) source rather than a local context or git ref; newer source kinds not yet supported by the update path; programmatic construction of sources with unexpected Kind.

Related errors


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