Skip to content

fix(backup): guard resolvedDbPath + drop redundant api.resolvePath (Issue #682)#750

Open
samson1357924 wants to merge 1 commit intoCortexReach:masterfrom
samson1357924:fix/backup-typeerror-202605051633
Open

fix(backup): guard resolvedDbPath + drop redundant api.resolvePath (Issue #682)#750
samson1357924 wants to merge 1 commit intoCortexReach:masterfrom
samson1357924:fix/backup-typeerror-202605051633

Conversation

@samson1357924
Copy link
Copy Markdown

問題描述

Issue #682:backup failed: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined

根本原因(PR #743 分析)

OpenClaw 2026.4.x API 變更: 對已經是絕對路徑的輸入,現在會返回 (不再重複處理)。

兩處受影響程式碼:

  1. : → resolvedDbPath 已是絕對路徑,再包 api.resolvePath() → undefined → mkdir 炸錯
  2. :相同問題

修復方案(雙層保護)

  1. 根因修復(PR fix(backup+admission): drop redundant api.resolvePath on already-absolute paths (Issue #682, supersedes PR #695) #743:移除多餘的 包裝

    • :直接使用
    • :用 判斷是否需要 resolve
  2. 防禦性檢查(本地額外增加)

    • → skip 並 warn
    • → skip 並 warn

變更檔案

驗證

2026-05-05T15:16:42.626Z warn plugins {"subsystem":"plugins"} memory-lancedb-pro: backup failed: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined

…ssue CortexReach#682, PR CortexReach#743)

Applies PR CortexReach#743 root-cause fix on top of local defensive check:
1. runBackup(): removed redundant api.resolvePath() wrapper since
   resolvedDbPath is already absolute — fixes TypeError in OpenClaw 2026.4.x
2. createAdmissionRejectionAuditWriter(): guard with startsWith('/')
   to only resolve() relative paths
3. Added defensive guard if resolvedDbPath is still undefined
4. Added regression test (PR CortexReach#743, 11 cases)

Also includes contracts.tools fix from PR CortexReach#749.
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.

1 participant