{"record":{"id":"9f698d065bf3e033","repo":"Mintplex-Labs/anything-llm","slug":"log-prefix-anythingllm-fetch-timeout-envdefi","errorCode":null,"errorMessage":"${LOG_PREFIX} ANYTHINGLLM_FETCH_TIMEOUT=\"${envDefinedTimeout}\" is not a valid positive integer — using default ${DEFAULT_TIMEOUT_MS}ms.","messagePattern":"(.+?) ANYTHINGLLM_FETCH_TIMEOUT=\"(.+?)\" is not a valid positive integer — using default (.+?)ms\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/utils/boot/patchSdkTimeouts.js","lineNumber":25,"sourceCode":" * at least 10 minutes for the 80% use case so\n * the transport layer doesn't kill connections before the SDK does.\n *\n * When `ANYTHINGLLM_FETCH_TIMEOUT` is set (milliseconds), both the undici\n * dispatcher and the SDK-level AbortController deadline are raised to that\n * value instead — for users with slow local models that need even longer.\n *\n * Must be called before any provider module is required.\n */\nfunction patchSdkTimeouts() {\n  const envDefinedTimeout = process.env.ANYTHINGLLM_FETCH_TIMEOUT;\n  const envDefinedMaxRetries = process.env.ANYTHINGLLM_MAX_RETRIES;\n  let timeoutMs = DEFAULT_TIMEOUT_MS;\n  let maxRetries = DEFAULT_MAX_RETRIES;\n\n  if (envDefinedTimeout) {\n    const parsed = parseInt(envDefinedTimeout, 10);\n    if (!Number.isFinite(parsed) || parsed <= 0) {\n      console.warn(\n        `${LOG_PREFIX} ANYTHINGLLM_FETCH_TIMEOUT=\"${envDefinedTimeout}\" is not a valid positive integer — using default ${DEFAULT_TIMEOUT_MS}ms.`\n      );\n    } else {\n      timeoutMs = parsed;\n    }\n  }\n\n  if (envDefinedMaxRetries) {\n    const parsed = parseInt(envDefinedMaxRetries, 10);\n    if (!Number.isFinite(parsed) || parsed < 0) {\n      console.warn(\n        `${LOG_PREFIX} ANYTHINGLLM_MAX_RETRIES=\"${envDefinedMaxRetries}\" is not a valid non-negative integer — using default ${DEFAULT_MAX_RETRIES}.`\n      );\n    } else {\n      maxRetries = parsed;\n    }\n  }\n","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/boot/patchSdkTimeouts.js#L7-L43","documentation":"patchSdkTimeouts parsed ANYTHINGLLM_FETCH_TIMEOUT with parseInt and the result was NaN or <= 0, so the SDK fetch timeout remains at DEFAULT_TIMEOUT_MS instead of your value. Because parseInt is lenient ('5000x' parses as 5000), this specifically fires for values like 'abc', '0', '-1', or empty-ish garbage.","triggerScenarios":"ANYTHINGLLM_FETCH_TIMEOUT set to '0', a negative number, or a non-numeric string; .env saved with CRLF/BOM corrupting the value; quoting artifacts from compose files producing an unparseable string.","commonSituations":"Operators copying timeout values with units attached ('10s'); CI injecting an empty string rather than unsetting; Windows-edited env files.","solutions":["Set ANYTHINGLLM_FETCH_TIMEOUT to a plain positive integer in milliseconds (e.g. 60000 for 60s).","Remove units/quotes/spaces from the value.","Re-save the env file with LF line endings and no BOM.","Check the companion variable ANYTHINGLLM_MAX_RETRIES for the same formatting problems."],"exampleFix":"# before\nANYTHINGLLM_FETCH_TIMEOUT=10s\n\n# after\nANYTHINGLLM_FETCH_TIMEOUT=10000","handlingStrategy":"validation","validationCode":"// Fail fast on bad numeric env values at boot:\nconst t = process.env.ANYTHINGLLM_FETCH_TIMEOUT;\nif (t != null && (!/^\\d+$/.test(t) || Number(t) <= 0)) {\n  throw new Error(`ANYTHINGLLM_FETCH_TIMEOUT=\"${t}\" must be a positive integer (ms)`);\n}","typeGuard":"function isPositiveIntegerEnv(value) {\n  return /^\\d+$/.test(value ?? '') && Number(value) > 0;\n}","tryCatchPattern":null,"preventionTips":["Document timeouts in milliseconds with examples (no units).","Lint env files in CI for numeric-format variables.","Save env files with LF endings and no BOM/quotes around numbers.","After setting the variable, confirm the boot log no longer prints the fallback warning."],"tags":["env-var","timeout","configuration","sdk"],"backgroundTag":"invalid-env-var-value","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}