Tencent/WeKnora · error

ErrSkillBundleInvalid

ErrSkillBundleInvalid

Error message

%w: archive is too large

What it means

unzipSkillArchive rejects a skill archive whose decompressed entries exceed maxSkillBundleTotalBytes (a zip-bomb / size-limit guard). ErrSkillBundleInvalid is wrapped; the upload is treated as an invalid bundle, not a server error.

Source

Thrown at internal/application/service/tenant_skill_bundle.go:105

	files, err := stripSkillRootPrefix(raw, opts)
	if err != nil {
		return nil, err
	}
	return skillBundleFromFiles(archive, files)
}

func unzipSkillArchive(archive []byte, opts SkillBundleParseOptions) (map[string][]byte, error) {
	entries, err := skillZipEntries(archive, opts)
	if err != nil {
		return nil, err
	}

	raw := make(map[string][]byte, len(entries))
	var totalBytes int64
	for _, item := range entries {
		entryBytes := item.size
		if totalBytes+entryBytes > maxSkillBundleTotalBytes {
			return nil, fmt.Errorf("%w: archive is too large", ErrSkillBundleInvalid)
		}
		totalBytes += entryBytes
		content, err := readLimitedZipEntry(item.file)
		if err != nil {
			return nil, err
		}
		if int64(len(content)) > entryBytes {
			actualExcess := int64(len(content)) - entryBytes
			if totalBytes+actualExcess > maxSkillBundleTotalBytes {
				return nil, fmt.Errorf("%w: archive is too large", ErrSkillBundleInvalid)
			}
			totalBytes += actualExcess
		}
		raw[item.name] = content
	}
	return raw, nil
}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Reduce the archive's contents or compress/split the skill files
  2. Raise maxSkillBundleTotalBytes only if the business allows larger bundles
  3. Validate archive size before upload to fail fast client-side
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/application/service/tenant_skill_bundle.go:105 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/fb0908e03a4d7bc1. Report an issue: GitHub.