{"record":{"id":"ae2537bf6ce5b548","repo":"ComposioHQ/composio","slug":"command-failed-with-exitcode-exitcode-nul","errorCode":null,"errorMessage":"${command} failed with exitCode=${exitCode ?? 'null'} signal=${signal ?? 'null'}: ${stderr.trim()}","messagePattern":"(.+?) failed with exitCode=(.+?) signal=(.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/cli-local-tools/src/toolkits/beeper-imessage.ts","lineNumber":259,"sourceCode":"  child.stderr.setEncoding('utf8');\n  child.stdout.on('data', chunk => {\n    stdout += chunk;\n  });\n  child.stderr.on('data', chunk => {\n    stderr += chunk;\n  });\n\n  const exitPromise = new Promise<{\n    readonly exitCode: number | null;\n    readonly signal: string | null;\n  }>((resolve, reject) => {\n    child.once('error', reject);\n    child.once('exit', (exitCode, signal) => resolve({ exitCode, signal }));\n  });\n  const timeout = setTimeout(() => child.kill('SIGTERM'), timeoutMs);\n  const { exitCode, signal } = await exitPromise.finally(() => clearTimeout(timeout));\n  if (exitCode !== 0) {\n    throw new Error(\n      `${command} failed with exitCode=${exitCode ?? 'null'} signal=${signal ?? 'null'}${\n        stderr.trim() ? `: ${stderr.trim()}` : ''\n      }`\n    );\n  }\n  return { stdout, stderr };\n};\n\nconst contactLookupScript = `\nfunction normalizePhone(value) {\n  return String(value || '').replace(/[^0-9]/g, '');\n}\nfunction normalizeIdentifier(value) {\n  const text = String(value || '').trim().toLowerCase();\n  if (!text) return '';\n  if (text.indexOf('@') >= 0) return text;\n  return normalizePhone(text) || text;\n}","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/cli-local-tools/src/toolkits/beeper-imessage.ts#L241-L277","documentation":"Generic helper in the beeper-imessage toolkit that runs a child process and throws when it exits non-zero. The message includes the command, exitCode, signal, and stderr. It is the toolkit-level equivalent of the runtime's command failure (243) and usually wraps tools like sqlite3 or imessage database queries.","triggerScenarios":"The underlying macOS command (e.g. sqlite3 querying chat.db) failing due to permissions, missing binary, malformed SQL, or the process being SIGTERM'd by the built-in timeout.","commonSituations":"Terminal app lacks Full Disk Access on macOS so chat.db reads fail; sqlite3 not installed; query timeouts on large thread databases.","solutions":["Check stderr in the message for the exact command failure","Grant Full Disk Access to the terminal/CLI on macOS (System Settings → Privacy & Security)","Ensure required binaries (sqlite3) are on PATH","Simplify the query / narrow the time window if hitting the timeout"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { const { stdout } = await runProcess(cmd, args, ctx); } catch (e) { if (e instanceof Error && e.message.includes('failed with exitCode')) surface(e.message); }","preventionTips":["Grant Full Disk Access on macOS","Verify sqlite3 and helper binaries are installed before use"],"tags":["subprocess","imessage","macos","exit-code"],"backgroundTag":"command-exit-nonzero","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}