dagger/dagger · error
elem type: %w
Error message
elem type: %w
What it means
argTypeToJSONSchema maps GraphQL types to JSON schema. For list types it recurses on t.Elem and wraps the result as {type: array, items: ...}; if the recursive conversion of the element type fails, the error is wrapped as "elem type". The recursion means the wrap can repeat for nested lists, showing the failing leaf type at the innermost cause.
Source
Thrown at core/llm_object_tools.go:692
"type": "object",
"properties": properties,
"additionalProperties": false,
}
if len(required) > 0 {
jsonSchema["required"] = required
}
return jsonSchema, nil
}
// argTypeToJSONSchema converts a GraphQL argument type to a JSON-schema fragment.
// It resurrects the pre-Dang arg→schema conversion, scoped to a single argument.
func argTypeToJSONSchema(schema *ast.Schema, t *ast.Type) (map[string]any, error) {
jsonSchema := map[string]any{}
if t.Elem != nil {
jsonSchema["type"] = "array"
items, err := argTypeToJSONSchema(schema, t.Elem)
if err != nil {
return nil, fmt.Errorf("elem type: %w", err)
}
jsonSchema["items"] = items
} else {
switch t.NamedType {
case "Int":
jsonSchema["type"] = "integer"
case "Float":
jsonSchema["type"] = "number"
case "String", "ID":
jsonSchema["type"] = "string"
case "Boolean":
jsonSchema["type"] = "boolean"
default:
typeDef, found := schema.Types[t.NamedType]
if !found {
return nil, fmt.Errorf("unknown type: %q", t.NamedType)
}
switch typeDef.Kind {View on GitHub (pinned to 82ba2681db)
Solutions
- Read the innermost wrapped error to identify the unmapped element NamedType.
- Add the element type to the defining schema or use a supported type in the function signature.
- Regenerate the schema (dagger develop) so all referenced types are present.
- Avoid custom scalars in list arguments of tool-exposed methods, or extend argTypeToJSONSchema if you own the integration.
Example fix
// before func tags(ctx context.Context, vals []MyCustomScalar) ([]string, error) // after func tags(ctx context.Context, vals []string) ([]string, error)
Defensive patterns
Strategy: validation
Validate before calling
func hasSupportedElem(schema *ast.Schema, t *ast.Type) bool {
for t != nil && t.Elem != nil { t = t.Elem }
if t == nil { return false }
switch t.NamedType {
case "String", "Int", "Boolean", "Float", "ID", "":
return true
}
def := schema.Types[t.NamedType]
return def != nil && (def.Kind == ast.Object || def.Kind == ast.Interface)
} Try / catch
items, err := argTypeToJSONSchema(schema, t.Elem)
if err != nil {
return nil, fmt.Errorf("unsupported list element type %s; use a standard scalar", t.Elem.Name())
} Prevention
- Prefer String/Int/Boolean element types for list arguments
- Ensure all referenced types exist in the defining schema
- Avoid custom scalars inside tool-exposed list arguments
When it happens
Trigger: Converting a method argument or field whose list element type has no mapping — an unknown/unmapped NamedType (custom scalar not handled by the switch), or a nil/inconsistent Elem chain in the AST type.
Common situations: Module functions taking lists of custom scalars or types missing from the defining schema; nested lists of unsupported types; stale schemas missing the element type definition.
Related errors
- build schema for %s.%s: %w
- bound object of type %q has neither a loaded value nor an ID
- load bound object of type %q: %w
- bound object type %q has no defining schema
- bound object type %q is not an object in its defining schema
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/9976a735ba80a0a7.
Report an issue: GitHub.