{"record":{"id":"a890909f41929156","repo":"hcengineering/platform","slug":"error-syncing-npmrc-file-e","errorCode":null,"errorMessage":"Error syncing .npmrc file: ${e}","messagePattern":"Error syncing \\.npmrc file: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"foundations/communication/common/scripts/install-run.js","lineNumber":223,"sourceCode":"            // Ensure the target folder exists\n            if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(targetNpmrcFolder)) {\n                fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(targetNpmrcFolder, { recursive: true });\n            }\n            return _copyAndTrimNpmrcFile({\n                sourceNpmrcPath,\n                targetNpmrcPath,\n                logger,\n                ...options\n            });\n        }\n        else if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(targetNpmrcPath)) {\n            // If the source .npmrc doesn't exist and there is one in the target, delete the one in the target\n            logger.info(`Deleting ${targetNpmrcPath}`); // Verbose\n            fs__WEBPACK_IMPORTED_MODULE_0__.unlinkSync(targetNpmrcPath);\n        }\n    }\n    catch (e) {\n        throw new Error(`Error syncing .npmrc file: ${e}`);\n    }\n}\nfunction isVariableSetInNpmrcFile(sourceNpmrcFolder, variableKey, supportEnvVarFallbackSyntax) {\n    const sourceNpmrcPath = `${sourceNpmrcFolder}/.npmrc`;\n    //if .npmrc file does not exist, return false directly\n    if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(sourceNpmrcPath)) {\n        return false;\n    }\n    const trimmedNpmrcFile = _trimNpmrcFile({ sourceNpmrcPath, supportEnvVarFallbackSyntax });\n    const variableKeyRegExp = new RegExp(`^${variableKey}=`, 'm');\n    return trimmedNpmrcFile.match(variableKeyRegExp) !== null;\n}\n//# sourceMappingURL=npmrcUtilities.js.map\n\n/***/ })\n\n/******/ \t});\n/************************************************************************/","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/communication/common/scripts/install-run.js#L205-L241","documentation":"loadCollabJson in foundations/server/packages/collaboration/src/storage.ts logs ctx.warn('invalid content type') when the blob's contentType does not include 'application/json'. Like its ydoc counterpart, it only warns and proceeds — the blob is read and returned as a string regardless. It flags that markup/JSON collaboration data is stored under an unexpected content type.","triggerScenarios":"A blobId resolved for collaboration JSON (e.g. markup) whose stat() contentType is not application/json — typically blobs written by older code paths or migrated without contentType metadata.","commonSituations":"Legacy data written before JSON content-type tagging; storage migration or backup restore dropping contentType; upload code failing to set contentType; the wrong blob id passed for a markup document.","solutions":["If the JSON parses fine downstream, treat this as informational and optionally correct the blob's contentType metadata.","Confirm the blobId refers to the JSON/markup object and not another attachment.","Re-write the document through the current API so it persists with contentType application/json.","If consumers fail to parse the content, restore from backup or re-generate the markup data."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const blob = await storageAdapter.stat(ctx, wsIds, blobId)\nif (blob !== undefined && !blob.contentType.includes('application/json')) {\n  ctx.warn('refusing to load non-json blob as collaboration json', { blobId, contentType: blob.contentType })\n}","typeGuard":"function isJsonBlob(blob: { contentType: string } | undefined): blob is { contentType: string } & Record<string, unknown> {\n  return blob !== undefined && blob.contentType.includes('application/json')\n}","tryCatchPattern":"try {\n  const raw = await loadCollabJson(ctx, wsIds, blobId)\n  JSON.parse(raw)\n} catch (err) {\n  // malformed or wrong content — restore from backup or regenerate the markup data\n}","preventionTips":["Set contentType to application/json when writing markup/JSON collaboration blobs.","Validate that stored content parses as JSON when adopting legacy data.","Keep contentType metadata intact across migrations and restores."],"tags":["collaboration","json","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"}