[错误报告]: tarko CLI 将定义但为空的环境变量解析为变量的自身名称

作者: sxh313创建于 2026年9月23日更新于 2026年9月23日

multimodal/tarko/agent-cli/src/utils/misc.ts:19-27

typescript
// If value is in all uppercase, treat it as an environment variable
if (/^[A-Z][A-Z0-9_]*$/.test(value)) {
  const envValue = process.env[value];
  if (envValue) {
    logger.debug(`Using ${label} from environment variable: ${value}`);
    return envValue;
  } else {
    logger.warn(`Environment variable "${value}" not found, using as literal value`);
  }
}

return value;

Two things go wrong once process.env[value] is '':

  1. the function returns OPENAI_API_KEY — the identifier, 15 characters of plaintext placeholder — as the resolved API key / base URL, so the run does not fail fast but goes out with a fabricated credential;
  2. the only diagnostic it prints, Environment variable "OPENAI_API_KEY" not found, is false. The variable is found; it is empty. That message is the thing a user will grep for, and it points them at the wrong file.

内容来源: bytedance/UI-TARS-desktop