{"record":{"id":"cc2888adea1dea60","repo":"hcengineering/platform","slug":"unexpected-exception-could-not-detect-node-path-o","errorCode":null,"errorMessage":"Unexpected exception: could not detect node path or script path","messagePattern":"Unexpected exception: could not detect node path or script path","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"foundations/communication/common/scripts/install-run-rush.js","lineNumber":165,"sourceCode":"}\nfunction _getBin(scriptName) {\n    switch (scriptName.toLowerCase()) {\n        case 'install-run-rush-pnpm.js':\n            return 'rush-pnpm';\n        case 'install-run-rushx.js':\n            return 'rushx';\n        default:\n            return 'rush';\n    }\n}\nfunction _run() {\n    const [nodePath /* Ex: /bin/node */, scriptPath /* /repo/common/scripts/install-run-rush.js */, ...packageBinArgs /* [build, --to, myproject] */] = process.argv;\n    // Detect if this script was directly invoked, or if the install-run-rushx script was invokved to select the\n    // appropriate binary inside the rush package to run\n    const scriptName = path__WEBPACK_IMPORTED_MODULE_0__.basename(scriptPath);\n    const bin = _getBin(scriptName);\n    if (!nodePath || !scriptPath) {\n        throw new Error('Unexpected exception: could not detect node path or script path');\n    }\n    let commandFound = false;\n    let logger = { info: console.log, error: console.error };\n    for (const arg of packageBinArgs) {\n        if (arg === '-q' || arg === '--quiet') {\n            // The -q/--quiet flag is supported by both `rush` and `rushx`, and will suppress\n            // any normal informational/diagnostic information printed during startup.\n            //\n            // To maintain the same user experience, the install-run* scripts pass along this\n            // flag but also use it to suppress any diagnostic information normally printed\n            // to stdout.\n            logger = {\n                info: () => { },\n                error: console.error\n            };\n        }\n        else if (!arg.startsWith('-') || arg === '-h' || arg === '--help') {\n            // We either found something that looks like a command (i.e. - doesn't start with a \"-\"),","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/communication/common/scripts/install-run-rush.js#L147-L183","documentation":"loadCollabYdoc in foundations/server/packages/collaboration/src/storage.ts logs ctx.warn('invalid content type') when the blob's contentType does not include 'application/ydoc'. Notably it only warns and continues — the function still loads the blob and parses it as a YDoc, so this is a data-hygiene signal that a document stored with an unexpected content type is being opened as a collaboration ydoc.","triggerScenarios":"A blobId passed to loadCollabYdoc whose stored blob contentType is not application/ydoc — e.g. the blob was written by an older version, was stored without the correct content type, or the wrong blobId is being resolved.","commonSituations":"Documents created before ydoc content-type tagging was introduced; data migrated between storage backends losing contentType metadata; upload pipelines writing blobs without setting contentType; lookup bugs passing an unrelated blob id.","solutions":["If the document loads fine, treat this as informational — optionally fix the blob's contentType metadata in storage.","Verify the blobId being passed corresponds to a ydoc object, not another attachment.","Re-save/migrate the document through the current version so it is stored with contentType application/ydoc.","If parsing subsequently fails, restore the document from backup or re-create it, since the stored bytes are not valid ydoc content."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const blob = await storageAdapter.stat(ctx, wsIds, blobId)\nif (blob !== undefined && !blob.contentType.includes('application/ydoc')) {\n  ctx.warn('refusing to load non-ydoc blob as ydoc', { blobId, contentType: blob.contentType })\n}","typeGuard":"function isYdocBlob(blob: { contentType: string } | undefined): blob is { contentType: string } & Record<string, unknown> {\n  return blob !== undefined && blob.contentType.includes('application/ydoc')\n}","tryCatchPattern":"try {\n  const ydoc = await loadCollabYdoc(ctx, wsIds, blobId)\n} catch (err) {\n  // after an 'invalid content type' warning, parse failures mean the bytes are not ydoc —\n  // fall back to a backup copy or re-create the document\n}","preventionTips":["Always set contentType explicitly when writing collaboration blobs.","Run a storage audit that reports blobs with content types inconsistent with their use.","Preserve contentType metadata during storage migrations and backup restores."],"tags":["collaboration","ydoc","content-type","data-hygiene"],"backgroundTag":"unexpected-blob-content-type","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}