{"record":{"id":"ea0378c673f07cbf","repo":"crewAIInc/crewAI","slug":"no-platform-integration-token-found-please-set-th","errorCode":null,"errorMessage":"No platform integration token found, please set the CREWAI_PLATFORM_INTEGRATION_TOKEN environment variable","messagePattern":"No platform integration token found, please set the CREWAI_PLATFORM_INTEGRATION_TOKEN environment variable","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/crewai_platform_tools/misc.py","lineNumber":14,"sourceCode":"import os\n\n\ndef get_platform_api_base_url() -> str:\n    \"\"\"Get the platform API base URL from environment or use default.\"\"\"\n    base_url = os.getenv(\"CREWAI_PLUS_URL\", \"https://app.crewai.com\")\n    return f\"{base_url}/crewai_plus/api/v1/integrations\"\n\n\ndef get_platform_integration_token() -> str:\n    \"\"\"Get the platform API base URL from environment or use default.\"\"\"\n    token = os.getenv(\"CREWAI_PLATFORM_INTEGRATION_TOKEN\") or \"\"\n    if not token:\n        raise ValueError(\n            \"No platform integration token found, please set the CREWAI_PLATFORM_INTEGRATION_TOKEN environment variable\"\n        )\n    return token  # TODO: Use context manager to get token\n","sourceCodeStart":1,"sourceCodeEnd":18,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/crewai_platform_tools/misc.py#L1-L18","documentation":"crewai_tools.tools.crewai_platform_tools.misc.get_platform_integration_token() reads the CREWAI_PLATFORM_INTEGRATION_TOKEN environment variable and raises this ValueError when it is unset or empty. The token authenticates calls from the CrewAI platform integration tools (e.g. JSONSearchTool-style platform tools) to the CrewAI Plus API at CREWAI_PLUS_URL (default https://app.crewai.com).","triggerScenarios":"Calling get_platform_integration_token() (directly or via a platform tool's _run) in a shell, notebook, container, or agent process where CREWAI_PLATFORM_INTEGRATION_TOKEN is not exported or is set to an empty string.","commonSituations":"Token never added to .env / .bashrc; .env file present but not loaded by the runtime; CI/CD secrets not wired; variable name typo (e.g. CREWAI_INTEGRATION_TOKEN); token defined in one deployment but missing in another.","solutions":["Set the environment variable before running: export CREWAI_PLATFORM_INTEGRATION_TOKEN=<your token from CrewAI Platform settings>.","If using dotenv, add CREWAI_PLATFORM_INTEGRATION_TOKEN=... to .env and ensure load_dotenv() runs before tool usage.","In Docker/CI, inject it as a secret/environment variable (docker run -e, GitHub Actions secrets.env, etc.).","Check for typos and trailing whitespace in the variable name and confirm it is not set to an empty value."],"exampleFix":"# before\nfrom crewai_tools.tools.crewai_platform_tools.misc import get_platform_integration_token\nget_platform_integration_token()  # ValueError\n\n# after\nimport os\nos.environ[\"CREWAI_PLATFORM_INTEGRATION_TOKEN\"] = os.environ[\"CREWAI_PLATFORM_INTEGRATION_TOKEN\"] or \"<token>\"\nget_platform_integration_token()","handlingStrategy":"validation","validationCode":"import os\n\nTOKEN = os.getenv(\"CREWAI_PLATFORM_INTEGRATION_TOKEN\", \"\")\nif not TOKEN:\n    raise SystemExit(\n        \"Missing CREWAI_PLATFORM_INTEGRATION_TOKEN — set it in your environment/secret store.\"\n    )","typeGuard":null,"tryCatchPattern":"from crewai_tools.tools.crewai_platform_tools.misc import get_platform_integration_token\n\ntry:\n    token = get_platform_integration_token()\nexcept ValueError:\n    # degrade gracefully: disable platform tools or prompt for setup\n    token = None","preventionTips":["Centralize environment loading (load_dotenv) at process start, before tools are constructed.","Store the token in a secret manager and inject it into every deployment environment.","Fail fast at startup with a checklist of missing env vars rather than mid-run."],"tags":["environment-variable","authentication","crewai-platform","configuration","token"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}