{"record":{"id":"3e26018fb0cfe904","repo":"cube-js/cube","slug":"config-decorator-must-be-used-with-functions-act","errorCode":null,"errorMessage":"@config decorator must be used with functions, actual: '%s'","messagePattern":"@config decorator must be used with functions, actual: '(.+?)'","errorType":"exception","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"packages/cubejs-backend-native/python/cube/src/__init__.py","lineNumber":136,"sourceCode":"        self.query_rewrite = None\n        self.extend_context = None\n        self.scheduled_refresh_contexts = None\n        self.scheduled_refresh_time_zones = None\n        self.context_to_api_scopes = None\n        self.repository_factory = None\n        self.schema_version = None\n        self.semantic_layer_sync = None\n        self.pre_aggregations_schema = None\n        self.orchestrator_options = None\n        self.context_to_groups = None\n        self.fast_reload = None\n\n    def __call__(self, func):\n        if isinstance(func, str):\n            return AttrRef(self, func)\n\n        if not callable(func):\n            raise ConfigurationException(\"@config decorator must be used with functions, actual: '%s'\" % type(func).__name__)\n\n        if hasattr(self, func.__name__):\n            setattr(self, func.__name__, func)\n        else:\n            raise ConfigurationException(\"Unknown configuration property: '%s'\" % func.__name__)\n\nclass AttrRef:\n    config: Configuration\n    attribute: str\n\n    def __init__(self, config: Configuration, attribute: str):\n        self.config = config\n        self.attribute = attribute\n\n    def __call__(self, func):\n        if not callable(func):\n            raise ConfigurationException(\"@config decorator must be used with functions, actual: '%s'\" % type(func).__name__)\n","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-backend-native/python/cube/src/__init__.py#L118-L154","documentation":"ConfigurationException raised in the Python cube package's @config decorator __call__ when the decorated object is not callable — i.e. the decorator was applied to something other than a function (the message reports the actual type's __name__). The decorator expects a plain function whose name maps to a configuration property.","triggerScenarios":"Thrown at packages/cubejs-backend-native/python/cube/src/__init__.py:136 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Apply @config only to functions/methods (e.g. @config def query_rewrite(...)), not to classes or other objects.","If configuring a property via a string, use the AttrRef form (config('prop_name')) instead of decorating a non-callable.","Check decorator ordering — another decorator may have wrapped the function into a non-callable type before @config ran."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}