{"record":{"id":"35299b84bd6188d6","repo":"ruvnet/ruflo","slug":"cannot-compose-morphisms-f-name-target-f-t","errorCode":null,"errorMessage":"Cannot compose morphisms: ${f.name} (target: ${f.target}) and ${g.name} (source: ${g.source}) - target of first must equal source of second","messagePattern":"Cannot compose morphisms: (.+?) \\(target: (.+?)\\) and (.+?) \\(source: (.+?)\\) - target of first must equal source of second","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/plugins/prime-radiant/src/engines/CategoryEngine.ts","lineNumber":100,"sourceCode":"      return {\n        valid: false,\n        result: null,\n        naturalTransformation: false\n      };\n    }\n  }\n\n  /**\n   * Compose two morphisms: g . f (apply f then g)\n   *\n   * @param f - First morphism\n   * @param g - Second morphism\n   * @returns Composed morphism\n   */\n  async compose(f: Morphism, g: Morphism): Promise<Morphism> {\n    // Verify composability: f.target === g.source\n    if (f.target !== g.source) {\n      throw new Error(\n        `Cannot compose morphisms: ${f.name} (target: ${f.target}) and ${g.name} (source: ${g.source}) - ` +\n        `target of first must equal source of second`\n      );\n    }\n\n    // Create composed morphism\n    const composedName = `${g.name} . ${f.name}`;\n\n    // Register the composed functor\n    const fFunctor = this.functorRegistry.get(f.name);\n    const gFunctor = this.functorRegistry.get(g.name);\n\n    if (fFunctor && gFunctor) {\n      this.functorRegistry.set(composedName, (input: unknown) => {\n        const intermediate = fFunctor(input);\n        return gFunctor(intermediate);\n      });\n    }","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/plugins/prime-radiant/src/engines/CategoryEngine.ts#L82-L118","documentation":"CategoryEngine.compose() verified composability of the two morphisms and f.target does not equal g.source — composing g after f is undefined in category theory. The error names both morphisms and their mismatched objects; align the target/source before composing.","triggerScenarios":"Thrown at v3/plugins/prime-radiant/src/engines/CategoryEngine.ts:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the underlying cause in logs, fix the root issue, and retry the operation.","Validate inputs and preconditions before invoking this code path so the error is avoided."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}