{"record":{"id":"271f7f9ef25a4474","repo":"microsoft/semantic-kernel","slug":"self-config-key-not-found-in-configuration","errorCode":null,"errorMessage":"\"{self.config_key}\" not found in configuration.","messagePattern":"\"(.+?)\" not found in configuration\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"python/samples/demos/copilot_studio_skill/src/api/auth.py","lineNumber":23,"sourceCode":"\nfrom botframework.connector.auth import JwtTokenValidation, SkillValidation\nfrom config import Config\n\n\nclass AllowedCallersClaimsValidator:\n    config_key = \"ALLOWED_CALLERS\"\n\n    def __init__(self, config: Config):\n        if not config:\n            raise TypeError(\"AllowedCallersClaimsValidator: config object cannot be None.\")\n\n        # ALLOWED_CALLERS is the setting in config.py file\n        # that consists of the list of parent bot ids that are allowed to access the skill\n        # to add a new parent bot simply go to the AllowedCallers and add\n        # the parent bot's microsoft app id to the list\n        caller_list = getattr(config, self.config_key)\n        if caller_list is None:\n            raise TypeError(f'\"{self.config_key}\" not found in configuration.')\n        self._allowed_callers = frozenset(caller_list)\n\n    @property\n    def claims_validator(self) -> Callable[[list[dict]], Awaitable]:\n        async def allow_callers_claims_validator(claims: dict[str, object]):\n            # if allowed_callers is None we allow all calls\n            if \"*\" not in self._allowed_callers and SkillValidation.is_skill_claim(claims):\n                # Check that the appId claim in the skill request is in the list of skills configured for this bot.\n                app_id = JwtTokenValidation.get_app_id_from_claims(claims)\n                if app_id not in self._allowed_callers:\n                    raise PermissionError(\n                        f'Received a request from a bot with an app ID of \"{app_id}\".'\n                        f\" To enable requests from this caller, add the app ID to your configuration file.\"\n                    )\n\n            return\n\n        return allow_callers_claims_validator","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/samples/demos/copilot_studio_skill/src/api/auth.py#L5-L41","documentation":"A TypeError raised when the Config object exists but has no ALLOWED_CALLERS attribute (getattr returns None). The validator derives its allowed-caller set from config.ALLOWED_CALLERS; if that setting is absent the frozenset cannot be built and authorization cannot be enforced.","triggerScenarios":"Constructing AllowedCallersClaimsValidator with a Config class/instance whose ALLOWED_CALLERS is None — e.g. a custom Config that omits the field, or ALLOWED_CALLERS env var unset with no default.","commonSituations":"Using a Config subclass without ALLOWED_CALLERS; the env var was unset and the Config default was removed; copy-paste config that dropped the field.","solutions":["Ensure Config defines ALLOWED_CALLERS (the sample defaults it to ['*'] via os.getenv).","Set the ALLOWED_CALLERS env var, or '*' to allow all callers.","Restore the field on the Config class if it was removed during customization."],"exampleFix":"// before\nclass Config:\n    HOST = os.getenv(\"HOST\")\n    # ALLOWED_CALLERS missing\n\n// after\nclass Config:\n    HOST = os.getenv(\"HOST\")\n    ALLOWED_CALLERS = os.getenv(\"ALLOWED_CALLERS\", [\"*\"])","handlingStrategy":"validation","validationCode":"from config import config\nif getattr(config, 'ALLOWED_CALLERS', None) is None:\n    raise SystemExit(\"Config.ALLOWED_CALLERS is missing; set ALLOWED_CALLERS env var.\")","typeGuard":"def config_has_allowed_callers(cfg) -> bool:\n    return getattr(cfg, 'ALLOWED_CALLERS', None) is not None","tryCatchPattern":null,"preventionTips":["Always define ALLOWED_CALLERS with a default on the Config class.","Add a startup assertion for required Config fields before building the validator."],"tags":["configuration","validation","authentication","bot-framework","copilot-studio"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}