cube-js/cube · error · ConfigurationException

@config decorator must be used with functions, actual: '%s'

Error message

@config decorator must be used with functions, actual: '%s'

What it means

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.

Source

Thrown at packages/cubejs-backend-native/python/cube/src/__init__.py:136

        self.query_rewrite = None
        self.extend_context = None
        self.scheduled_refresh_contexts = None
        self.scheduled_refresh_time_zones = None
        self.context_to_api_scopes = None
        self.repository_factory = None
        self.schema_version = None
        self.semantic_layer_sync = None
        self.pre_aggregations_schema = None
        self.orchestrator_options = None
        self.context_to_groups = None
        self.fast_reload = None

    def __call__(self, func):
        if isinstance(func, str):
            return AttrRef(self, func)

        if not callable(func):
            raise ConfigurationException("@config decorator must be used with functions, actual: '%s'" % type(func).__name__)

        if hasattr(self, func.__name__):
            setattr(self, func.__name__, func)
        else:
            raise ConfigurationException("Unknown configuration property: '%s'" % func.__name__)

class AttrRef:
    config: Configuration
    attribute: str

    def __init__(self, config: Configuration, attribute: str):
        self.config = config
        self.attribute = attribute

    def __call__(self, func):
        if not callable(func):
            raise ConfigurationException("@config decorator must be used with functions, actual: '%s'" % type(func).__name__)

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Apply @config only to functions/methods (e.g. @config def query_rewrite(...)), not to classes or other objects.
  2. If configuring a property via a string, use the AttrRef form (config('prop_name')) instead of decorating a non-callable.
  3. Check decorator ordering — another decorator may have wrapped the function into a non-callable type before @config ran.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cubejs-backend-native/python/cube/src/__init__.py:136 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/3e26018fb0cfe904. Report an issue: GitHub.