{"record":{"id":"bda812e1f6b5db4d","repo":"perspective-dev/perspective","slug":"cannot-initialize-perspectivewidget-index-or-li","errorCode":null,"errorMessage":"Cannot initialize PerspectiveWidget `index` or `limit` without a Table, data, or schema!","messagePattern":"Cannot initialize PerspectiveWidget `index` or `limit` without a Table, data, or schema!","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"rust/perspective-python/perspective/widget/__init__.py","lineNumber":207,"sourceCode":"\n        #     if config.get(\"split_by\", None) and \"split_by\" not in kwargs:\n        #         kwargs.update({\"split_by\": config[\"split_by\"]})\n\n        #     if config.get(\"columns\", None) and \"columns\" not in kwargs:\n        #         kwargs.update({\"columns\": config[\"columns\"]})\n\n        # Initialize the viewer\n        super(PerspectiveWidget, self).__init__(**kwargs)\n\n        # Handle messages from the the front end\n        self.on_msg(self.handle_message)\n        self._sessions = {}\n\n        # If an empty dataset is provided, don't call `load()` and wait\n        # for the user to call `load()`.\n        if data is None:\n            if index is not None or limit is not None:\n                raise TypeError(\n                    \"Cannot initialize PerspectiveWidget `index` or `limit` without a Table, data, or schema!\"\n                )\n        else:\n            if index is not None:\n                self._options.update({\"index\": index})\n\n            if limit is not None:\n                self._options.update({\"limit\": limit})\n\n            loading = self.load(data, **self._options)\n            if inspect.isawaitable(loading):\n                import asyncio\n\n                asyncio.create_task(loading)\n\n    def load(self, data, **options):\n        \"\"\"Load the widget with data.\"\"\"\n        # Viewer will ignore **options if `data` is a Table or View.","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/perspective-dev/perspective/blob/11c8238c0c9c0b9e490b5a6a2dc277afad1e980a/rust/perspective-python/perspective/widget/__init__.py#L189-L225","documentation":"PerspectiveWidget.__init__ can only configure index/limit windows when it has something to load: a Table instance, raw data, or a schema. When all of these are absent (the deferred-load case where the user will call load() later), applying index/limit at construction has no target, so the constructor rejects the combination.","triggerScenarios":"Thrown at rust/perspective-python/perspective/widget/__init__.py:207 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a Table, data, or schema to PerspectiveWidget when using index or limit","Defer the index/limit settings to the load() call instead of the constructor","Construct the widget empty, then call widget.load(table, index=..., limit=...) once data is available"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"11c8238c0c9c0b9e490b5a6a2dc277afad1e980a","analyzedAt":"2026-09-09T00:35:19.377Z","contentChangedAt":"2026-09-09T00:35:19.377Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}