{"record":{"id":"fcdfc8a384e03c5a","repo":"toeverything/AFFiNE","slug":"docs-search-skipped-malformed-references","errorCode":null,"errorMessage":"[docs-search] skipped malformed references","messagePattern":"\\[docs-search\\] skipped malformed references","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/modules/docs-search/services/docs-search.ts","lineNumber":312,"sourceCode":"              string,\n              Map<string, { docId: string } & ReferenceParams>\n            >();\n            for (const node of nodes) {\n              const sourceId = stringField(node.fields.docId);\n              const parsed = parseIndexedReferences(node.fields.ref);\n              malformed += parsed.malformed;\n              if (!sourceId || !docIds.includes(sourceId)) continue;\n              let sourceRefs = refsBySource.get(sourceId);\n              if (!sourceRefs) {\n                sourceRefs = new Map();\n                refsBySource.set(sourceId, sourceRefs);\n              }\n              for (const ref of parsed.refs) {\n                if (ref.docId !== sourceId) sourceRefs.set(ref.docId, ref);\n              }\n            }\n            if (malformed > 0) {\n              console.warn('[docs-search] skipped malformed references', {\n                count: malformed,\n              });\n            }\n\n            return new Map(\n              docIds.map(sourceId => [\n                sourceId,\n                Array.from(refsBySource.get(sourceId)?.values() ?? []).flatMap(\n                  ref => {\n                    const doc = this.docsService.list.doc$(ref.docId).value;\n                    if (!doc) return [];\n                    const params = omit(ref, ['docId']);\n                    return [\n                      {\n                        title: doc.title$.value,\n                        docId: doc.id,\n                        params: isEmpty(params)\n                          ? undefined","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/modules/docs-search/services/docs-search.ts#L294-L330","documentation":"Warning logged in `watchRefsBySourceFrom` when, after scanning indexed reference fields, some entries were malformed — `parseIndexedReferences` reported `malformed > 0` or nodes lacked a valid docId field. The corrupted reference entries are excluded from the refsBySource map; indexing proceeds with the well-formed ones.","triggerScenarios":"Triggered when the docs-search indexer parses stored reference data and finds entries that fail validation, skipping those malformed references while building the backlink map.","commonSituations":"Occurs when indexed doc-link data is corrupted or written by an incompatible version. Backlinks may be incomplete; reindexing the docs usually resolves it.","solutions":["Fix or remove the malformed references in the doc.","Re-index after correcting the reference data."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}