{"record":{"id":"e36e5298a970dbe5","repo":"oven-sh/bun","slug":"expected-type-for-argument-name-got-inspect","errorCode":null,"errorMessage":"Expected type for argument ${name}, got ${inspect(type)}","messagePattern":"Expected type for argument (.+?), got (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/codegen/bindgen-lib-internal.ts","lineNumber":835,"sourceCode":"    [isFunc]: true,\n    name: \"\",\n    snapshot,\n    sourceFile,\n    variants,\n  };\n  allFunctions.push(func);\n  file.functions.push(func);\n  return func;\n}\n\nfunction validateVariant(variant: any) {\n  let minRequiredArgs = 0;\n  let seenOptionalArgument = false;\n  let i = 0;\n\n  for (const [name, type] of Object.entries(variant.args) as [string, TypeImpl][]) {\n    if (!(type instanceof TypeImpl)) {\n      throw new Error(`Expected type for argument ${name}, got ${inspect(type)}`);\n    }\n    i += 1;\n    if (type.isVirtualArgument()) {\n      continue;\n    }\n    if (!type.flags.optional && !(\"default\" in type.flags)) {\n      if (seenOptionalArgument) {\n        throw new Error(`Required argument ${name} cannot follow an optional argument`);\n      }\n      minRequiredArgs++;\n    } else {\n      seenOptionalArgument = true;\n    }\n  }\n\n  return { minRequiredArgs };\n}\n","sourceCodeStart":817,"sourceCodeEnd":853,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/codegen/bindgen-lib-internal.ts#L817-L853","documentation":"Error \"Expected type for argument ${name}, got ${inspect(type)}\" thrown in oven-sh/bun.","triggerScenarios":"Thrown at src/codegen/bindgen-lib-internal.ts:835 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}