dagger/dagger · error · IntrospectionError
Use of primitive 'String' type detected, please use 'string'
Error message
Use of primitive 'String' type detected, please use 'string' instead.
What it means
Dagger's TypeScript SDK maps JavaScript primitives to Dagger scalars, but only the lowercase literal types (`string`, `boolean`, `number`) are supported. The boxed-looking type names `String`, `Boolean`, and `Number` are interface wrappers and cannot be represented as Dagger scalars, so resolveReferences throws immediately to force correct usage.
Source
Thrown at sdk/typescript/src/module/introspector/dagger_module/module.ts:234
}
this.resolveReferences(daggerInterface.getReferences())
continue
}
const typeAliasRef = this.ast.findResolvedNodeByName(
reference,
ts.SyntaxKind.TypeAliasDeclaration,
)
if (typeAliasRef) {
// The resolution is to big so we split it in a sub function.
this.resolveTypeAlias(reference, typeAliasRef)
continue
}
// Handle primitives here
if (reference === "String") {
throw new IntrospectionError(
`Use of primitive 'String' type detected, please use 'string' instead.`,
)
}
if (reference === "Boolean") {
throw new IntrospectionError(
`Use of primitive 'Boolean' type detected, please use 'boolean' instead.`,
)
}
if (reference === "Number") {
throw new IntrospectionError(
`Use of primitive 'Number' type detected, please use 'number' instead.`,
)
}
throw new IntrospectionError(
`could not resolve type reference for ${reference}.`,View on GitHub (pinned to 82ba2681db)
Solutions
- Change the annotation from `String` to lowercase `string` in the function signature or field.
- Fix all occurrences (search the module for `: String` / `<String>` / `String[]`).
- Re-run `dagger develop` to regenerate and confirm the error is gone.
Example fix
// before
async greet(name: String): String { ... }
// after
async greet(name: string): string { ... } Defensive patterns
Strategy: type-guard
Validate before calling
// Grep-based pre-check before dagger develop // ! grep -rnE ':\s*String\b|<String>|String\[\]' sdk/**/*.ts grep -rnE '(:\s*|<)String\b' src/ && echo 'found String, use string' && exit 1 || true
Type guard
function usesLowercasePrimitives(sig: Record<string, string>): boolean {
return Object.values(sig).every(t => !/^(String|Boolean|Number)$/.test(t.trim()))
} Try / catch
try {
await dagger.develop()
} catch (e) {
if (String(e).includes("Use of primitive 'String'")) {
console.error("Replace String with string"); process.exit(1)
}
throw e
} Prevention
- Always write lowercase string/boolean/number in module code
- Add an ESLint rule (no-undef or @typescript-eslint/no-wrapper-object-types) banning String/Boolean/Number as types
- Grep for capitalized primitives in CI
When it happens
Trigger: Any dagger function parameter, return type, or @field whose type annotation is written as `String` (capital S) and reaches resolveReferences as a type reference, e.g. `async greet(name: String)`.
Common situations: Developers coming from Java/C#/Python writing capitalized primitives; auto-import picking the global `String` interface; code migrated from another SDK where `String` was valid.
Related errors
- Use of primitive 'Boolean' type detected, please use 'boolea
- Use of primitive 'Number' type detected, please use 'number'
- could not find type reference for ${this._returnTypeRef} at
- could not resolve name of interface at ${AST.getNodePosition
- could not resolve name of interface function at ${AST.getNod
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/c0e40678462cec11.
Report an issue: GitHub.