Skip to content

fix: read KB files from /knowledge/{id}/files endpoint (#89) - #90

Open
plevart wants to merge 1 commit into
open-webui:mainfrom
plevart:fix/validate-deep-file-count
Open

fix: read KB files from /knowledge/{id}/files endpoint (#89)#90
plevart wants to merge 1 commit into
open-webui:mainfrom
plevart:fix/validate-deep-file-count

Conversation

@plevart

@plevart plevart commented Jul 31, 2026

Copy link
Copy Markdown

validate --deep, status, and ls derived the KB file list from GET /knowledge/{id}, whose files field is a server-hydrated convenience that Open WebUI version 0.11.0 returns as null. Reading len(kb.get("files", [])) then crashed with "object of type 'NoneType' has no len()" because .get()'s default only applies to a missing key, not an explicit null. ls silently printed "(empty)" for the same reason. Sync was unaffected as it uses the server-side /sync/diff endpoint.

Point the file listing at the real GET /knowledge/{id}/files endpoint (returns {items, total}): fix list_kb_files, add count_kb_files for the authoritative total, and use them in the affected commands.

Fixes #89

`validate --deep`, `status`, and `ls` derived the KB file list from
`GET /knowledge/{id}`, whose `files` field is a server-hydrated
convenience that some Open WebUI versions return as null. Reading
`len(kb.get("files", []))` then crashed with "object of type 'NoneType'
has no len()" because .get()'s default only applies to a missing key,
not an explicit null. `ls` silently printed "(empty)" for the same
reason. Sync was unaffected as it uses the server-side /sync/diff
endpoint.

Point the file listing at the real `GET /knowledge/{id}/files`
endpoint (returns {items, total}): fix list_kb_files, add
count_kb_files for the authoritative total, and use them in the
affected commands.

Fixes open-webui#89

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oikb validate --deep fails with: object of type 'NoneType' has no len()

1 participant