{"record":{"id":"9976a735ba80a0a7","repo":"dagger/dagger","slug":"elem-type-w","errorCode":null,"errorMessage":"elem type: %w","messagePattern":"elem type: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/llm_object_tools.go","lineNumber":692,"sourceCode":"\t\t\"type\":                 \"object\",\n\t\t\"properties\":           properties,\n\t\t\"additionalProperties\": false,\n\t}\n\tif len(required) > 0 {\n\t\tjsonSchema[\"required\"] = required\n\t}\n\treturn jsonSchema, nil\n}\n\n// argTypeToJSONSchema converts a GraphQL argument type to a JSON-schema fragment.\n// It resurrects the pre-Dang arg→schema conversion, scoped to a single argument.\nfunc argTypeToJSONSchema(schema *ast.Schema, t *ast.Type) (map[string]any, error) {\n\tjsonSchema := map[string]any{}\n\tif t.Elem != nil {\n\t\tjsonSchema[\"type\"] = \"array\"\n\t\titems, err := argTypeToJSONSchema(schema, t.Elem)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"elem type: %w\", err)\n\t\t}\n\t\tjsonSchema[\"items\"] = items\n\t} else {\n\t\tswitch t.NamedType {\n\t\tcase \"Int\":\n\t\t\tjsonSchema[\"type\"] = \"integer\"\n\t\tcase \"Float\":\n\t\t\tjsonSchema[\"type\"] = \"number\"\n\t\tcase \"String\", \"ID\":\n\t\t\tjsonSchema[\"type\"] = \"string\"\n\t\tcase \"Boolean\":\n\t\t\tjsonSchema[\"type\"] = \"boolean\"\n\t\tdefault:\n\t\t\ttypeDef, found := schema.Types[t.NamedType]\n\t\t\tif !found {\n\t\t\t\treturn nil, fmt.Errorf(\"unknown type: %q\", t.NamedType)\n\t\t\t}\n\t\t\tswitch typeDef.Kind {","sourceCodeStart":674,"sourceCodeEnd":710,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/llm_object_tools.go#L674-L710","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nfunc tags(ctx context.Context, vals []MyCustomScalar) ([]string, error)\n// after\nfunc tags(ctx context.Context, vals []string) ([]string, error)","handlingStrategy":"validation","validationCode":"func hasSupportedElem(schema *ast.Schema, t *ast.Type) bool {\n    for t != nil && t.Elem != nil { t = t.Elem }\n    if t == nil { return false }\n    switch t.NamedType {\n    case \"String\", \"Int\", \"Boolean\", \"Float\", \"ID\", \"\":\n        return true\n    }\n    def := schema.Types[t.NamedType]\n    return def != nil && (def.Kind == ast.Object || def.Kind == ast.Interface)\n}","typeGuard":null,"tryCatchPattern":"items, err := argTypeToJSONSchema(schema, t.Elem)\nif err != nil {\n    return nil, fmt.Errorf(\"unsupported list element type %s; use a standard scalar\", t.Elem.Name())\n}","preventionTips":["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"],"tags":["dagger","llm-tools","json-schema","type-mapping"],"backgroundTag":"unsupported-argument-type","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}