[GH-ISSUE #111] Issue: Sync fails with Permission denied when lock files (~$...) are present in source folder #64

Open
opened 2026-10-18 21:14:01 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @Joni1717 on GitHub (Aug 24, 2026).
Original GitHub issue: https://github.com/open-webui/oikb/issues/111

Type: Bug

Description

Syncing a network path aborts when the folder contains Office lock files:

Syncing: /mapped/path/to/source → <kb-id>
  Failed: [Errno 13] Permission denied: '...\\source\\subfolder\\~$document.xlsx'

~$... files are created by Office while a workbook is open and are exclusively locked, so they can't be read.

Root cause

Even with an include filter set, oikb walks the entire tree and reads metadata (hash) for every file before applying the filter:

sources:
- name: source
  source: "/mapped/path/to/source"
  kb-id: <kb-id>
  filter:
    include: ["target.xlsx"]

So the scanner hits a locked ~$... file that would never be uploaded anyway, and the whole sync fails.

Expected behavior

  1. Skip temp/lock files before reading metadata — at minimum ~$*, ~*, *.tmp, hidden files (.*).
  2. Apply filter.include/exclude before opening files, so non-matching files are never read.
  3. Treat PermissionError as a soft skip (warning: skip <file> (permission denied)) and continue — on network shares, locked files (Excel, Outlook, AV, concurrent users) are normal and should not be a hard failure.

Actual behavior

PermissionError is raised unhandled → the entire sync fails, nothing gets uploaded.

Repro

  1. Network path containing an office file, for example .xlsx currently open in Excel (creates ~$...).
  2. Config pointing at that path, with filter.include targeting a different file.
  3. Run sync → error above.

Workaround

Close all open documents in the source folder (removes ~$...), then re-run.

Environment

  • OS: Windows 11
  • python 3.11 installed with Venv
  • oikb version: v0.4.0
Originally created by @Joni1717 on GitHub (Aug 24, 2026). Original GitHub issue: https://github.com/open-webui/oikb/issues/111 **Type:** Bug ## Description Syncing a network path aborts when the folder contains Office lock files: ``` Syncing: /mapped/path/to/source → <kb-id> Failed: [Errno 13] Permission denied: '...\\source\\subfolder\\~$document.xlsx' ``` `~$...` files are created by Office while a workbook is open and are exclusively locked, so they can't be read. ## Root cause Even with an `include` filter set, oikb walks the **entire tree** and reads metadata (hash) for **every** file **before** applying the filter: ``` sources: - name: source source: "/mapped/path/to/source" kb-id: <kb-id> filter: include: ["target.xlsx"] ``` So the scanner hits a locked `~$...` file that would never be uploaded anyway, and the whole sync fails. ## Expected behavior 1. **Skip temp/lock files before reading metadata** — at minimum `~$*`, `~*`, `*.tmp`, hidden files (`.*`). 2. **Apply `filter.include`/`exclude` before opening files**, so non-matching files are never read. 3. **Treat `PermissionError` as a soft skip** (`warning: skip <file> (permission denied)`) and continue — on network shares, locked files (Excel, Outlook, AV, concurrent users) are normal and should not be a hard failure. ## Actual behavior `PermissionError` is raised unhandled → the entire sync fails, nothing gets uploaded. ## Repro 1. Network path containing an office file, for example `.xlsx` currently open in Excel (creates `~$...`). 2. Config pointing at that path, with `filter.include` targeting a *different* file. 3. Run sync → error above. ## Workaround Close all open documents in the source folder (removes `~$...`), then re-run. ## Environment - OS: Windows 11 - python 3.11 installed with Venv - oikb version: v0.4.0
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/oikb#64
No description provided.