{"id":"a3cd13dcf62a7e89","repo":"evanw/esbuild","slug":"missing-second-argument-in-callname-call","errorCode":null,"errorMessage":"Missing second argument in ${callName}() call","messagePattern":"Missing second argument in (.+?)\\(\\) call","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/shared/common.ts","lineNumber":789,"sourceCode":"      } catch (e) {\n        let flags: string[] = []\n        try { pushLogFlags(flags, options, {}, isTTY, transformLogLevelDefault) } catch { }\n        const error = extractErrorMessageV8(e, streamIn, details, void 0, '')\n        sendRequest(refs, { command: 'error', flags, error }, () => {\n          error.detail = details.load(error.detail)\n          callback(failureErrorWithLog('Transform failed', [error], []), null)\n        })\n      }\n    }\n    if ((typeof input === 'string' || input instanceof Uint8Array) && input.length > 1024 * 1024) {\n      let next = start\n      start = () => fs.writeFile(input, next)\n    }\n    start(null)\n  }\n\n  let formatMessages: StreamService['formatMessages'] = ({ callName, refs, messages, options, callback }) => {\n    if (!options) throw new Error(`Missing second argument in ${callName}() call`)\n    let keys: OptionKeys = {}\n    let kind = getFlag(options, keys, 'kind', mustBeString)\n    let color = getFlag(options, keys, 'color', mustBeBoolean)\n    let terminalWidth = getFlag(options, keys, 'terminalWidth', mustBeInteger)\n    checkForInvalidFlags(options, keys, `in ${callName}() call`)\n    if (kind === void 0) throw new Error(`Missing \"kind\" in ${callName}() call`)\n    if (kind !== 'error' && kind !== 'warning') throw new Error(`Expected \"kind\" to be \"error\" or \"warning\" in ${callName}() call`)\n    let request: protocol.FormatMsgsRequest = {\n      command: 'format-msgs',\n      messages: sanitizeMessages(messages, 'messages', null, '', terminalWidth),\n      isWarning: kind === 'warning',\n    }\n    if (color !== void 0) request.color = color\n    if (terminalWidth !== void 0) request.terminalWidth = terminalWidth\n    sendRequest<protocol.FormatMsgsRequest, protocol.FormatMsgsResponse>(refs, request, (error, response) => {\n      if (error) return callback(new Error(error), null)\n      callback(null, response!.messages)\n    })","sourceCodeStart":771,"sourceCodeEnd":807,"githubUrl":"https://github.com/evanw/esbuild/blob/6ff1d8b0d8c134e867a397eef39702a223ebef9e/lib/shared/common.ts#L771-L807","documentation":"Error \"Missing second argument in ${callName}() call\" thrown in evanw/esbuild.","triggerScenarios":"Thrown at lib/shared/common.ts:789 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the options object as the second argument to the API call","Provide the required second argument even if it is an empty object"],"exampleFix":"await esbuild.transform(code, { loader: 'ts' });\n// or with explicit empty options:\nawait esbuild.transform(code, {});","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"6ff1d8b0d8c134e867a397eef39702a223ebef9e","analyzedAt":"2026-08-03T19:42:38.433Z","schemaVersion":2}