{"record":{"id":"1cc970d92e34eef1","repo":"zylon-ai/private-gpt","slug":"bundle-too-large","errorCode":"BUNDLE_TOO_LARGE","errorMessage":"Skill bundle size ({total} bytes) exceeds the maximum allowed size of {self._max_bundle_size_bytes} bytes.","messagePattern":"Skill bundle size \\((.+?) bytes\\) exceeds the maximum allowed size of (.+?) bytes\\.","errorType":"exception","errorClass":"SkillDomainError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/skills/services/skill_service.py","lineNumber":66,"sourceCode":"    ) -> None:\n        self._skill_repository = skill_repository\n        self._max_bundle_size_bytes = settings.skills.max_bundle_size_bytes\n        local_root = str(Path(settings.data.local_data_folder) / \"storage\")\n        self._storage_bucket_name = settings.s3.durable_bucket_name\n        self._storage_component = storage_component.get_object_storage(\n            provider=settings.skills.storage_provider,\n            local_root_path=local_root,\n            bucket_name=self._storage_bucket_name,\n        )\n        self._cache = cache\n\n    def _check_bundle_size(self, files: list[StoredFile]) -> None:\n        if self._max_bundle_size_bytes is None:\n            return\n        total = sum(len(f.content) for f in files)\n        if total > self._max_bundle_size_bytes:\n            max_mb = round(self._max_bundle_size_bytes / (1024 * 1024))\n            raise SkillDomainError(\n                SkillErrorCode.BUNDLE_TOO_LARGE,\n                f\"Skill bundle size ({total} bytes) exceeds the maximum allowed \"\n                f\"size of {self._max_bundle_size_bytes} bytes.\",\n                params={\"size\": str(max_mb)},\n            )\n\n    async def create_skill(\n        self,\n        collection: str,\n        display_title: str,\n        source: Literal[\"custom\", \"anthropic\", \"zylon\"],\n        loading: Literal[\"eager\", \"lazy\"],\n        readonly: bool,\n        files: list[StoredFile],\n    ) -> SkillEntity:\n        self._check_bundle_size(files)\n        skill_id = new_skill_id()\n        version_id = new_skill_version_id()","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/skills/services/skill_service.py#L48-L84","documentation":"SkillService._check_bundle_size sums the byte length of all StoredFile contents in an uploaded skill bundle and raises SkillDomainError BUNDLE_TOO_LARGE when the total exceeds the configured _max_bundle_size_bytes (None disables the check). The message reports both the actual and maximum byte counts, and params carries the limit in MB for API error rendering. It is a resource-exhaustion guard on skill uploads.","triggerScenarios":"Calling create_skill (or any path that stores a version bundle) with files whose combined size exceeds settings.skills max bundle size — e.g. shipping large binary assets, model files, or datasets inside the skill bundle.","commonSituations":"Bundling reference PDFs/images/scripts into a skill; increasing asset size over iterations until crossing the default cap; environments with a deliberately low cap; users zipping whole directories as a skill.","solutions":["Reduce the bundle: remove unused/large assets, compress images, or host big files externally and reference them by URL in the skill body.","If the content legitimately needs more room, raise the configured maximum bundle size (settings.skills.* bundle size option) — an admin/policy decision.","Pre-compute the total before upload: sum(len(content) for files) and compare to the documented limit.","Split one oversized skill into several focused skills."],"exampleFix":"# before\nawait service.create_skill(collection, files=all_files)  # BUNDLE_TOO_LARGE\n\n# after\ntotal = sum(len(f.content) for f in all_files)\nif total > MAX:\n    all_files = prune_large_assets(all_files)  # or raise a user-facing message\nawait service.create_skill(collection, files=all_files)","handlingStrategy":"validation","validationCode":"MAX_BUNDLE_BYTES = 10 * 1024 * 1024  # keep in sync with settings\n\ndef bundle_within_limit(files: list) -> bool:\n    return sum(len(f.content) for f in files) <= MAX_BUNDLE_BYTES\n\nif not bundle_within_limit(files):\n    files = drop_large_assets(files, budget=MAX_BUNDLE_BYTES)","typeGuard":null,"tryCatchPattern":"try:\n    await service.create_skill(collection, title, source, loading, files=files)\nexcept SkillDomainError as e:\n    if e.code is SkillErrorCode.BUNDLE_TOO_LARGE:\n        return HTTPException(413, \"Skill bundle too large; remove large assets or split the skill\")\n    raise","preventionTips":["Compute and enforce the size budget client-side before upload.","Keep binaries/models out of skill bundles; link to external storage instead.","Track per-skill bundle size in CI so growth is noticed before it breaches the cap."],"tags":["skills","upload","size-limit","validation","configuration"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}