{"record":{"id":"45466dc602dadd21","repo":"xai-org/x-algorithm","slug":"xai-async-emb-timeout-seconds-must-be-a-positive-i","errorCode":null,"errorMessage":"XAI_ASYNC_EMB_TIMEOUT_SECONDS must be a positive integer","messagePattern":"XAI_ASYNC_EMB_TIMEOUT_SECONDS must be a positive integer","errorType":"exception","errorClass":"std::invalid_argument","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/cuda/async_emb/src/async_emb_comm.cc","lineNumber":68,"sourceCode":"\nvoid requireEnvironment(const char* name, const char* expected) {\n  const char* value = std::getenv(name);\n  if (value == nullptr || std::strcmp(value, expected) != 0) {\n    throw std::runtime_error(\n        \"async_emb requires \" + std::string(name) + \"=\" + expected + \" before process startup\"\n    );\n  }\n}\n\nstd::chrono::seconds watchdogTimeout() {\n  const char* value = std::getenv(\"XAI_ASYNC_EMB_TIMEOUT_SECONDS\");\n  if (value == nullptr) {\n    return std::chrono::seconds(1800);\n  }\n  char* end = nullptr;\n  long seconds = std::strtol(value, &end, 10);\n  if (end == value || *end != '\\0' || seconds <= 0) {\n    throw std::invalid_argument(\"XAI_ASYNC_EMB_TIMEOUT_SECONDS must be a positive integer\");\n  }\n  return std::chrono::seconds(seconds);\n}\n\nstd::once_flag warmup_once;\n\nvoid warmupKernels(int8_t* scratch, cudaStream_t stream) {\n  auto* bf16 = reinterpret_cast<__nv_bfloat16*>(scratch);\n  auto* f32 = reinterpret_cast<float*>(scratch);\n  auto* i32 = reinterpret_cast<int32_t*>(scratch);\n  const SliceLayout slices{0, 8, 1};\n  launch_lookup_dispatch(i32, bf16, bf16, slices, 1, stream);\n  launch_grad_dispatch(bf16, bf16, slices, stream);\n  launch_grad_segment_sum(bf16, i32, f32, f32, slices, 0, stream);\n  launch_lookup_combine(bf16, bf16, slices, stream);\n  XAI_CUDA_CHECK(cudaStreamSynchronize(stream));\n}\n","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/cuda/async_emb/src/async_emb_comm.cc#L50-L86","documentation":"XAI_ASYNC_EMB_TIMEOUT_SECONDS is parsed with strtol and must be a strictly positive integer with no trailing characters. If it is unset the code falls back to a 1800-second watchdog, so this error only fires when the variable exists but is malformed (empty, zero, negative, fractional, or containing non-numeric suffixes).","triggerScenarios":"Setting XAI_ASYNC_EMB_TIMEOUT_SECONDS to values like \"\", \"0\", \"-5\", \"30s\", \"1.5\", or \"1800 \" while constructing AsyncEmbContext (watchdogTimeout is called from the constructor).","commonSituations":"Kubernetes manifests quoting the value (\"1800\" is fine but \"30s\" from a duration convention is not), CI templates appending units, copy-paste from docs of a different timeout variable that accepts durations.","solutions":["Export a plain positive integer: export XAI_ASYNC_EMB_TIMEOUT_SECONDS=1800.","Remove quotes/units/whitespace from the value in your job spec or .env file.","If you do not need a custom timeout, unset the variable to use the 1800s default."],"exampleFix":"# before\nexport XAI_ASYNC_EMB_TIMEOUT_SECONDS=\"30m\"\n\n# after\nexport XAI_ASYNC_EMB_TIMEOUT_SECONDS=1800","handlingStrategy":"validation","validationCode":"const char* v = std::getenv(\"XAI_ASYNC_EMB_TIMEOUT_SECONDS\");\nif (v) {\n    char* end = nullptr;\n    long n = std::strtol(v, &end, 10);\n    if (end == v || *end != '\\0' || n <= 0)\n        throw std::runtime_error(\"XAI_ASYNC_EMB_TIMEOUT_SECONDS must be a positive integer\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use plain integers, no units or quotes, in env files.","Add a config lint step that regex-validates ^[1-9][0-9]*$ for this variable."],"tags":["env-var","validation","timeout","async-emb"],"backgroundTag":"invalid-env-var-value","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}