{"record":{"id":"c0e40678462cec11","repo":"dagger/dagger","slug":"use-of-primitive-string-type-detected-please-us","errorCode":null,"errorMessage":"Use of primitive 'String' type detected, please use 'string' instead.","messagePattern":"Use of primitive 'String' type detected, please use 'string' instead\\.","errorType":"exception","errorClass":"IntrospectionError","httpStatus":null,"severity":"error","filePath":"sdk/typescript/src/module/introspector/dagger_module/module.ts","lineNumber":234,"sourceCode":"        }\n        this.resolveReferences(daggerInterface.getReferences())\n        continue\n      }\n\n      const typeAliasRef = this.ast.findResolvedNodeByName(\n        reference,\n        ts.SyntaxKind.TypeAliasDeclaration,\n      )\n      if (typeAliasRef) {\n        // The resolution is to big so we split it in a sub function.\n        this.resolveTypeAlias(reference, typeAliasRef)\n\n        continue\n      }\n\n      // Handle primitives here\n      if (reference === \"String\") {\n        throw new IntrospectionError(\n          `Use of primitive 'String' type detected, please use 'string' instead.`,\n        )\n      }\n\n      if (reference === \"Boolean\") {\n        throw new IntrospectionError(\n          `Use of primitive 'Boolean' type detected, please use 'boolean' instead.`,\n        )\n      }\n\n      if (reference === \"Number\") {\n        throw new IntrospectionError(\n          `Use of primitive 'Number' type detected, please use 'number' instead.`,\n        )\n      }\n\n      throw new IntrospectionError(\n        `could not resolve type reference for ${reference}.`,","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/sdk/typescript/src/module/introspector/dagger_module/module.ts#L216-L252","documentation":"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.","triggerScenarios":"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)`.","commonSituations":"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.","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."],"exampleFix":"// before\nasync greet(name: String): String { ... }\n\n// after\nasync greet(name: string): string { ... }","handlingStrategy":"type-guard","validationCode":"// Grep-based pre-check before dagger develop\n// ! grep -rnE ':\\s*String\\b|<String>|String\\[\\]' sdk/**/*.ts\ngrep -rnE '(:\\s*|<)String\\b' src/ && echo 'found String, use string' && exit 1 || true","typeGuard":"function usesLowercasePrimitives(sig: Record<string, string>): boolean {\n  return Object.values(sig).every(t => !/^(String|Boolean|Number)$/.test(t.trim()))\n}","tryCatchPattern":"try {\n  await dagger.develop()\n} catch (e) {\n  if (String(e).includes(\"Use of primitive 'String'\")) {\n    console.error(\"Replace String with string\"); process.exit(1)\n  }\n  throw e\n}","preventionTips":["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"],"tags":["typescript","introspection","primitive-type","dagger-module"],"backgroundTag":"capitalized-primitive-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"}