microsoft/qlib · error · KeyError

Unknown parameter: {k}

Error message

Unknown parameter: {k}

What it means

Error "Unknown parameter: {k}" thrown in microsoft/qlib.

Source

Thrown at qlib/utils/serial.py:105

        kwargs may include following keys

            dump_all : bool
                will the object dump all object
            exclude : list
                What attribute will not be dumped
            include : list
                What attribute will be dumped

        recursive : bool
            will the configuration be recursive
        """
        keys = {"dump_all", "exclude", "include"}
        for k, v in kwargs.items():
            if k in keys:
                attr_name = f"_{k}"
                setattr(self, attr_name, v)
            else:
                raise KeyError(f"Unknown parameter: {k}")

        if recursive:
            for obj in self.__dict__.values():
                # set flag to prevent endless loop
                self.__dict__[self.FLAG_KEY] = True
                if isinstance(obj, Serializable) and self.FLAG_KEY not in obj.__dict__:
                    obj.config(recursive=True, **kwargs)
                del self.__dict__[self.FLAG_KEY]

    def to_pickle(self, path: Union[Path, str], **kwargs):
        """
        Dump self to a pickle file.

        path (Union[Path, str]): the path to dump

        kwargs may include following keys

            dump_all : bool

View on GitHub (pinned to 79633dd950)

Solutions

  1. Remove the unknown parameter from the call/config; only declared serializable fields are accepted.
  2. Check the parameter name for typos against the class definition.

When it happens

Trigger: This error is raised at qlib/utils/serial.py:105 when the guard condition fails: "Unknown parameter: {k}". It triggers when the code path receives input or a state that violates the precondition checked at this point — e.g. an unimplemented abstract method being called, an unsupported argument type/value, or an invalid configuration. To avoid it, satisfy the documented precondition before this call: implement the required method in your subclass, or pass a supported value of the expected type as described by the message.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15). Data as JSON: /api/errors/4cb2242f5614ae35. Report an issue: GitHub.