healProfilesModuleFallback() 遇到损坏的 package.json 时抛裸 SyntaxError,不带文件路径
#3324
Replies: 3 comments 1 reply
|
Thanks @Fable-Forge for the precise report and reproduction direction. I reproduced both forms on master at The fallback walker parses manifests at two points with inline I prepared a narrow patch that:
Fork commit: Branch: Validation:
Successful traversal, dependency ordering, symlink ownership, exports, and profile formats are unchanged. The patch does not attempt to repair or delete a corrupt installed manifest; it only makes the existing fatal diagnostic actionable. I left it as a fork commit because the project's contribution guide currently does not accept external pull requests. AI-assisted repository audit and implementation; I reviewed the source, reproduced the failure, and ran every validation listed above. The commit records |
|
I turned this failure mode into a preservation-first operator runbook: https://sandbaseai.github.io/deepseek-harness-handbook/corrupt-package-json-profile-boot.html The guide adds a read-only recursive scanner that follows pnpm directory symlinks, deduplicates real targets, and prints every malformed manifest with its path, size, and parser error. It then routes each bad path to its actual repair owner: selected global distribution, exact Two operational points are worth keeping alongside the upstream diagnostic patch:
The runbook finishes with an isolated exact-version probe, profile/runtime acceptance gates, cold-restart rescan, and the source diagnostic contract for wrapping only JSON parse failures while retaining native filesystem errors. Canonical guide: https://github.com/sandbaseai/deepseek-harness-handbook/blob/main/docs/en/troubleshooting/corrupt-package-json-profile-boot.md |
|
Verified at rc.8 ( There is a third bare const bundleManifest = JSON.parse(readFileSync(join(packageDir, 'package.json'), 'utf8')) as ProfileManifestThis runs when a profile declares So the Operational note for the reporter's DLP hypothesis: denial123789's runbook already covers the preservation-first workflow; the third call site just means the diagnostic now pinpoints which of the ~600 manifests failed without a manual scan in the bundle layer too. |
Uh oh!
There was an error while loading. Please reload this page.
环境
@deepseek-ai/dsh-app-boot@0.1.0-rc.6现象
healProfilesModuleFallback()会沿依赖树逐个读取package.json。其中任意一个文件损坏(内容被截断 / 变成 0 字节),抛出的是裸的 JSON 解析错误,
完全不提是哪个文件:
相关代码
@deepseek-ai/dsh-app-boot/lib/index.js的healProfilesModuleFallback():两处
JSON.parse(readFileSync(...))都没有把路径带进错误。期望
抛出的错误里包含出错文件的绝对路径,例如:
同一文件里的
readProfileManifest()已经做得很好(failed to read profile manifest ${path}),建议这里保持一致:
影响
我们排查一次真实故障时,这条错误是第一个岔路口。当时依赖树里约有 600 个
package.json,报错不指名文件,只能自己写脚本逐个扫 0 字节文件才定位到是
node-pty/package.json等 6 个文件被环境(透明加密 DLP)弄坏了。带上路径的话,这一步大概能省掉半小时以上。
相关
这三件事是同一次故障排查里发现的:
All reactions