{"record":{"id":"c146ebb22ec1c9f0","repo":"toeverything/AFFiNE","slug":"input-is-not-a-service-identifier","errorCode":null,"errorMessage":"Input is not a service identifier.","messagePattern":"Input is not a service identifier\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/common/infra/src/framework/core/identifier.ts","lineNumber":112,"sourceCode":"/**\n * Convert the constructor into a ServiceIdentifier.\n * As we always deal with ServiceIdentifier in the DI container.\n *\n * @internal\n */\nexport function createIdentifierFromConstructor<T extends Component>(\n  target: Type<T>\n): Identifier<T> {\n  return createIdentifier<T>(`${target.name}${stableHash(target)}`);\n}\n\nexport function parseIdentifier(input: any): IdentifierValue {\n  if (input.identifierName) {\n    return input as IdentifierValue;\n  } else if (typeof input === 'function' && input.name) {\n    return createIdentifierFromConstructor(input);\n  } else {\n    throw new Error('Input is not a service identifier.');\n  }\n}\n","sourceCodeStart":94,"sourceCodeEnd":115,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/common/infra/src/framework/core/identifier.ts#L94-L115","documentation":"parseIdentifier accepts only existing identifier objects or constructors and throws 'Input is not a service identifier.' for anything else, normalizing all DI lookups to IdentifierValue and catching garbage keys early.","triggerScenarios":"Thrown at packages/common/infra/src/framework/core/identifier.ts:112 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a service identifier created by the framework's identifier helpers, not a plain string or class.","Check the call site and replace the invalid input with the correct identifier export.","Verify the identifier import comes from the module that defines the service."],"exampleFix":null,"handlingStrategy":"type-guard","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"}