dagger/dagger · error
argument %q must be of type Directory to apply ignore patter
Error message
argument %q must be of type Directory to apply ignore pattern ([%s]) but type is %#v
What it means
The final fallback: the argument's resolved runtime value has a type entirely outside the shapes applyIgnoreOnDir understands, so ignore patterns cannot be applied. The message names the argument, its ignore patterns, and the offending Go value. It means "you asked for ignore on this argument, but what was passed is not anything Directory-ID-shaped".
Source
Thrown at core/modfunc.go:1377
case dagql.DynamicOptional:
if !value.Valid {
return nil, nil
}
switch id := value.Value.(type) {
case dagql.AnyID:
return applyIgnore(id)
case dagql.ID[*Directory]:
return applyIgnore(id)
case dagql.IDType:
if dirid, ok := id.(dagql.ID[*Directory]); ok {
return applyIgnore(dirid)
}
return nil, fmt.Errorf("not a directory id: %#v", id)
default:
return nil, fmt.Errorf("not a directory id: %#v", value.Value)
}
default:
return nil, fmt.Errorf("argument %q must be of type Directory to apply ignore pattern ([%s]) but type is %#v", arg.OriginalName, strings.Join(arg.Ignore, ", "), value)
}
}
// jsonListElements parses a JSON array default value into its elements. TOML
// array settings arrive JSON-encoded (see configValueToString); ok is false
// for plain strings, which callers split on commas instead.
func jsonListElements(userInput string) ([]any, bool) {
trimmed := strings.TrimSpace(userInput)
if !strings.HasPrefix(trimmed, "[") {
return nil, false
}
var list []any
if err := json.Unmarshal([]byte(trimmed), &list); err != nil {
return nil, false
}
return list, true
}
View on GitHub (pinned to 82ba2681db)
Solutions
- Ensure the argument is a single Directory and the value passed is its typed ID (or optional-wrapped ID).
- Remove ignore from non-Directory (e.g. list) arguments; apply excludes when constructing each Directory instead.
- Align SDK, CLI, and engine versions and regenerate the module SDK to restore the expected value shapes.
Example fix
// before: ignore on a list argument srcs []*Directory `ignore:"[\".git\"]"` // unsupported shape // after: single Directory argument, exclude applied at construction src *Directory // ignore valid; or client.Directory().WithExclude([".git"]) per element
Defensive patterns
Strategy: validation
Validate before calling
// confirm the argument is a single Directory before enabling ignore
if arg.TypeDef.Kind == ListTypeDefKind || !isDirectoryArg(arg.TypeDef) {
return fmt.Errorf("ignore patterns are only supported on a single Directory argument")
} Type guard
func valueIsDirectoryShaped(v any) bool {
switch t := v.(type) {
case dagql.ID[*Directory]: return true
case dagql.DynamicOptional: return t.Valid && isTypedID(t.Value)
default: return false
}
} Prevention
- Attach ignore only to single Directory parameters, never lists or other objects.
- Keep CLI, SDK, and engine on matching versions so decoder output shapes match.
- Marshal module call arguments through the SDK, not hand-written JSON.
When it happens
Trigger: An argument with ignore patterns receives a value of an unhandled Go type at the default switch arm — e.g. a JSON-decoded value, a *Directory instance object, or an array/map — instead of a typed dagql ID or optional-wrapped ID.
Common situations: Custom integrations invoking module functions with hand-marshaled JSON args; SDK version mismatch where the argument decoder emits new wrapper types applyIgnoreOnDir does not know; mistakenly putting ignore on a list-of-Directories argument.
Related errors
- [kind=%v] argument %q must be of type Directory to apply ign
- [ObjName=%v] argument %q must be of type Directory to apply
- get directory ID for ignore on %q: %w
- apply ignore pattern on directory %q: %w
- not a directory id: %#v
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/9cae85de344e0638.
Report an issue: GitHub.