{"record":{"id":"b13f8c4053304529","repo":"iflytek/astron-agent","slug":"masdk-polaris-url-environment-variable-is-not-configured","errorCode":null,"errorMessage":"MASDK_POLARIS_URL environment variable is not configured","messagePattern":"MASDK_POLARIS_URL environment variable is not configured","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"core/workflow/extensions/middleware/masdk/factory.py","lineNumber":41,"sourceCode":"    def create(self) -> MASDKService:\n        \"\"\"\n        Create a new MASDKService instance with configuration from environment variables.\n\n        Reads the following environment variables:\n        - MASDK_POLARIS_URL: Polaris service discovery URL\n        - MASDK_POLARIS_PROJECT: Polaris project name\n        - MASDK_POLARIS_GROUP: Polaris service group\n        - MASDK_POLARIS_SERVICE: Polaris service name\n        - MASDK_POLARIS_VERSION: Polaris service version\n        - MASDK_CHANNEL: MASDK channel configuration\n\n        :return: Configured MASDKService instance\n        :raises ValueError: If required environment variables are not set\n        \"\"\"\n        # Read Polaris service discovery configuration from environment variables\n        polaris_url = os.getenv(\"MASDK_POLARIS_URL\")\n        if not polaris_url:\n            raise ValueError(\"MASDK_POLARIS_URL environment variable is not configured\")\n\n        polaris_project = os.getenv(\"MASDK_POLARIS_PROJECT\")\n        if not polaris_url:\n            raise ValueError(\"MASDK_POLARIS_URL environment variable is not configured\")\n\n        polaris_group = os.getenv(\"MASDK_POLARIS_GROUP\")\n        if not polaris_url:\n            raise ValueError(\"MASDK_POLARIS_URL environment variable is not configured\")\n\n        polaris_service = os.getenv(\"MASDK_POLARIS_SERVICE\")\n        if not polaris_url:\n            raise ValueError(\"MASDK_POLARIS_URL environment variable is not configured\")\n\n        polaris_version = os.getenv(\"MASDK_POLARIS_VERSION\")\n        if not polaris_url:\n            raise ValueError(\"MASDK_POLARIS_URL environment variable is not configured\")\n\n        # Configure channel list with fallback to empty string","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/extensions/middleware/masdk/factory.py#L23-L59","documentation":"MASDKServiceFactory.create requires the MASDK_POLARIS_URL environment variable for Polaris service discovery and raises ValueError when it is unset or empty. This is the first (line 41) check of five in the factory's env-var validation.","triggerScenarios":"os.getenv(\"MASDK_POLARIS_URL\") returns None or \"\" when MASDKService is created through the service manager with the MASDK factory.","commonSituations":"Deploying the workflow service without the MASDK block in .env / docker-compose / Helm values; the variable only defined in a different service's env file; enabling an agent feature that touches MASDK without provisioning Polaris.","solutions":["Set MASDK_POLARIS_URL (e.g. http://polaris:8080) in the workflow service environment and restart.","Check docker-compose.yml / Helm values / .env for the workflow container specifically.","Confirm with `docker exec <container> env | grep MASDK` that the variable is actually injected.","If MASDK is optional, avoid instantiating MASDKService when Polaris is not configured."],"exampleFix":"// before (docker-compose.yml)\n  workflow:\n    environment: []\n// after\n  workflow:\n    environment:\n      - MASDK_POLARIS_URL=http://polaris:8080","handlingStrategy":"validation","validationCode":"import os\nassert os.getenv(\"MASDK_POLARIS_URL\"), \"MASDK_POLARIS_URL must be set before creating MASDKService\"","typeGuard":"def masdk_env_ready() -> bool:\n    return bool(os.getenv(\"MASDK_POLARIS_URL\"))","tryCatchPattern":"try:\n    service = service_manager.create_service(MASDKService)\nexcept ValueError as e:\n    logger.error(f\"MASDK misconfigured: {e}\")\n    raise","preventionTips":["Document MASDK_POLARIS_URL in deployment templates (.env.example, Helm values).","Validate required env vars at service startup with fail-fast checks.","Use a config schema (pydantic Settings) to require MASDK_* fields.","Verify with `env | grep MASDK` inside the running container."],"tags":["environment-variable","configuration","polaris","masdk"],"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-19T12:17:13.211Z"}