{"record":{"id":"47ae0af746d3624b","repo":"langgenius/dify","slug":"failed-to-parse-config-e","errorCode":null,"errorMessage":"Failed to parse config: {e}","messagePattern":"Failed to parse config: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"api/configs/remote_settings_sources/nacos/__init__.py","lineNumber":42,"sourceCode":"        data_id = os.getenv(\"DIFY_ENV_NACOS_DATA_ID\", \"dify-api-env.properties\")\n        group = os.getenv(\"DIFY_ENV_NACOS_GROUP\", \"nacos-dify\")\n        tenant = os.getenv(\"DIFY_ENV_NACOS_NAMESPACE\", \"\")\n\n        params = {\"dataId\": data_id, \"group\": group, \"tenant\": tenant}\n        try:\n            content = NacosHttpClient().http_request(\"/nacos/v1/cs/configs\", method=\"GET\", headers={}, params=params)\n            self.remote_configs = self._parse_config(content)\n        except Exception:\n            logger.exception(\"[get-access-token] exception occurred\")\n            raise\n\n    def _parse_config(self, content: str) -> dict[str, str]:\n        if not content:\n            return {}\n        try:\n            return parse_config(content)\n        except Exception as e:\n            raise RuntimeError(f\"Failed to parse config: {e}\")\n\n    @override\n    def get_field_value(self, field: FieldInfo, field_name: str) -> tuple[Any, str, bool]:\n        field_value = self.remote_configs.get(field_name)\n        if field_value is None:\n            return None, field_name, False\n\n        return field_value, field_name, False\n","sourceCodeStart":24,"sourceCodeEnd":51,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/configs/remote_settings_sources/nacos/__init__.py#L24-L51","documentation":"Raised by NacosSettingsSource._parse_config when parse_config(content) throws — i.e. the Nacos config payload could not be parsed into a key=value mapping (the default dataId expects Java .properties format). Wrapped as RuntimeError with the underlying exception message.","triggerScenarios":"Nacos returns YAML/JSON/toml content for the configured dataId while parse_config expects properties format, or the payload is malformed/truncated.","commonSituations":"DIFY_ENV_NACOS_DATA_ID pointing at a non-properties config, group/namespace mismatch returning unrelated content, or Nacos returning an HTML error page.","solutions":["Ensure the Nacos config referenced by DIFY_ENV_NACOS_DATA_ID is in Java .properties format.","Verify DIFY_ENV_NACOS_GROUP and DIFY_ENV_NACOS_NAMESPACE resolve to the intended config.","Open the dataId in the Nacos console and confirm it parses as key=value lines.","Check Nacos HTTP response is 200 with properties body, not an error page."],"exampleFix":"// before\n# Nacos dataId content:\nspring:\n  datasource:\n    url: jdbc:...\n// after\n# Nacos dataId content (properties):\nDB_USERNAME=dify\nDB_PASSWORD=dify\nSQLALCHEMY_DATABASE_URI=postgresql://dify:dify@db:5432/dify","handlingStrategy":"try-catch","validationCode":"from configs.remote_settings_sources.nacos.utils import parse_config\n\ndef nacos_content_parses(content: str) -> bool:\n    try:\n        parse_config(content)\n        return True\n    except Exception:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    source = NacosSettingsSource(configs)\nexcept RuntimeError as e:\n    logger.exception('Nacos config parse failed: %s', e)\n    raise","preventionTips":["Store Nacos config dataId in Java .properties format.","Confirm DIFY_ENV_NACOS_GROUP and NAMESPACE resolve to the right config.","Smoke-test parse_config against the live payload during deploy."],"tags":["config","nacos","remote-settings","runtime"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}