{"record":{"id":"91c34e1c5b7b1bfb","repo":"iflytek/astron-agent","slug":"kafka-servers-environment-variable-is-not-configured-please","errorCode":null,"errorMessage":"KAFKA_SERVERS environment variable is not configured. Please set KAFKA_SERVERS with comma-separated broker addresses","messagePattern":"KAFKA_SERVERS environment variable is not configured\\. Please set KAFKA_SERVERS with comma-separated broker addresses","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"core/workflow/configs/app_config.py","lineNumber":248,"sourceCode":"        description=\"Kafka operation timeout in seconds\",\n    )\n\n    kafka_session_timeout: int = Field(\n        default=int(os.getenv(\"KAFKA_SESSIONTIMEOUT\", \"30\")),\n        alias=\"KAFKA_SESSIONTIMEOUT\",\n        description=\"Kafka session timeout in seconds\",\n    )\n\n    @field_validator(\"kafka_servers\", mode=\"after\")\n    @classmethod\n    def validate_kafka_servers(cls, v: str) -> str:\n        \"\"\"Validate and clean Kafka servers configuration.\"\"\"\n        if not v:\n            v = os.getenv(\"KAFKA_SERVERS\", \"\")\n\n        v = v.strip()\n        if not v:\n            raise ValueError(\n                \"KAFKA_SERVERS environment variable is not configured. \"\n                \"Please set KAFKA_SERVERS with comma-separated broker addresses\"\n            )\n\n        return v\n\n\n# The built-in LangChain/Pyodide executor is isolated by Deno and therefore does\n# not require an external service or user-provided credentials.  Keep the\n# resource defaults conservative so a fresh deployment can execute Code nodes\n# without exposing the workflow process to untrusted Python code.\nDEFAULT_CODE_EXECUTOR_TYPE = \"langchain\"\nDEFAULT_CODE_EXEC_TIMEOUT_SEC = 10\nMIN_CODE_EXEC_TIMEOUT_SEC = 1\nMAX_CODE_EXEC_TIMEOUT_SEC = 600\nDEFAULT_CODE_EXEC_MEMORY_LIMIT_MB = 256\nMIN_CODE_EXEC_MEMORY_LIMIT_MB = 128\nMAX_CODE_EXEC_MEMORY_LIMIT_MB = 2048","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/configs/app_config.py#L230-L266","documentation":"Pydantic validator for the Kafka servers setting raises ValueError when KAFKA_SERVERS is empty after stripping, both when passed in and when read from the environment. The service cannot form a Kafka bootstrap connection without at least one broker address, so startup fails fast.","triggerScenarios":"Starting core/workflow without KAFKA_SERVERS set in the environment or .env/config file; KAFKA_SERVERS set to whitespace or an empty string; config loader (local/polaris) not exposing the variable so the validator's os.getenv fallback also returns ''.","commonSituations":"Fresh deployment where docker-compose .env was not copied; secrets/config not mounted in k8s; Polaris config missing the key for a new namespace; variable spelled KAFKA_BROKERS instead of KAFKA_SERVERS.","solutions":["Set KAFKA_SERVERS to a comma-separated broker list, e.g. KAFKA_SERVERS=kafka-1:9092,kafka-2:9092, and restart the service","Add the key to the .env / Polaris config used by the service and verify it is mounted into the container (docker inspect / kubectl describe)","Check the variable name spelling and that it is exported in the process environment (env | grep KAFKA)","Provide a sane default in the compose/helm values for dev environments"],"exampleFix":"// before\n# .env\n# KAFKA_SERVERS=\n// after\n# .env\nKAFKA_SERVERS=kafka:9092","handlingStrategy":"validation","validationCode":"import os\nservers = os.getenv(\"KAFKA_SERVERS\", \"\")\nif not servers.strip():\n    raise ConfigError(\"KAFKA_SERVERS must be set to comma-separated broker addresses before startup\")","typeGuard":null,"tryCatchPattern":"try:\n    settings = AppConfig()\nexcept ValidationError as e:\n    if \"KAFKA_SERVERS\" in str(e):\n        logger.critical(\"KAFKA_SERVERS not configured; aborting startup\")\n    raise SystemExit(2)","preventionTips":["Include KAFKA_SERVERS in .env.example and deployment templates","Verify env vars are mounted/exported in the container (env | grep KAFKA)","Use a startup readiness check that surfaces missing env vars clearly","Keep variable names consistent across compose, helm, and Polaris configs"],"tags":["kafka","configuration","environment","startup"],"backgroundTag":"missing-env-var","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}