{"id":"9143ed2431a97ded","repo":"evanw/esbuild","slug":"expected-value-for-what-key-void-0","errorCode":null,"errorMessage":"Expected value for ${what}${key !== void 0 ? ' ' + quote(key) : ''} to be a string, got ${typeof value} instead","messagePattern":"Expected value for (.+?)(.+?) to be a string, got (.+?) instead","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/shared/common.ts","lineNumber":140,"sourceCode":"  return validated\n}\n\ntype CommonOptions = types.BuildOptions | types.TransformOptions\n\nfunction pushLogFlags(flags: string[], options: CommonOptions, keys: OptionKeys, isTTY: boolean, logLevelDefault: types.LogLevel): void {\n  let color = getFlag(options, keys, 'color', mustBeBoolean)\n  let logLevel = getFlag(options, keys, 'logLevel', mustBeString)\n  let logLimit = getFlag(options, keys, 'logLimit', mustBeInteger)\n\n  if (color !== void 0) flags.push(`--color=${color}`)\n  else if (isTTY) flags.push(`--color=true`); // This is needed to fix \"execFileSync\" which buffers stderr\n  flags.push(`--log-level=${logLevel || logLevelDefault}`)\n  flags.push(`--log-limit=${logLimit || 0}`)\n}\n\nfunction validateStringValue(value: unknown, what: string, key?: string): string {\n  if (typeof value !== 'string') {\n    throw new Error(`Expected value for ${what}${key !== void 0 ? ' ' + quote(key) : ''} to be a string, got ${typeof value} instead`)\n  }\n  return value\n}\n\nfunction pushCommonFlags(flags: string[], options: CommonOptions, keys: OptionKeys): void {\n  let legalComments = getFlag(options, keys, 'legalComments', mustBeString)\n  let sourceRoot = getFlag(options, keys, 'sourceRoot', mustBeString)\n  let sourcesContent = getFlag(options, keys, 'sourcesContent', mustBeBoolean)\n  let target = getFlag(options, keys, 'target', mustBeStringOrArrayOfStrings)\n  let format = getFlag(options, keys, 'format', mustBeString)\n  let globalName = getFlag(options, keys, 'globalName', mustBeString)\n  let mangleProps = getFlag(options, keys, 'mangleProps', mustBeRegExp)\n  let reserveProps = getFlag(options, keys, 'reserveProps', mustBeRegExp)\n  let mangleQuoted = getFlag(options, keys, 'mangleQuoted', mustBeBoolean)\n  let minify = getFlag(options, keys, 'minify', mustBeBoolean)\n  let minifySyntax = getFlag(options, keys, 'minifySyntax', mustBeBoolean)\n  let minifyWhitespace = getFlag(options, keys, 'minifyWhitespace', mustBeBoolean)\n  let minifyIdentifiers = getFlag(options, keys, 'minifyIdentifiers', mustBeBoolean)","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/evanw/esbuild/blob/6ff1d8b0d8c134e867a397eef39702a223ebef9e/lib/shared/common.ts#L122-L158","documentation":"Error \"Expected value for ${what}${key !== void 0 ? ' ' + quote(key) : ''} to be a string, got ${typeof value} instead\" thrown in evanw/esbuild.","triggerScenarios":"Thrown at lib/shared/common.ts:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a string value instead of the reported type for this option","Convert the value to a string (e.g. with String(value)) before passing it"],"exampleFix":"// entryPoints must be strings, not numbers or objects\nesbuild.buildSync({ entryPoints: ['src/index.ts'] });","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"6ff1d8b0d8c134e867a397eef39702a223ebef9e","analyzedAt":"2026-08-03T19:42:38.433Z","schemaVersion":2}