{"record":{"id":"79b14a5667cfdf12","repo":"apache/incubator-seata","slug":"unknown-di-for-element-semantic-id","errorCode":null,"errorMessage":"unknown di for element ${semantic.id}","messagePattern":"unknown di for element (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"saga/seata-saga-statemachine-designer/src/modeling/SagaImporter.js","lineNumber":278,"sourceCode":"\n    source = attrs.source || this.getSource(semantic);\n    target = this.getTarget(semantic);\n    semantic.style.source = source;\n    semantic.style.target = target;\n\n    if (source && target) {\n      elementDefinition = elementData(semantic, {\n        source,\n        target,\n        waypoints,\n      });\n\n      element = elementFactory.createConnection(elementDefinition);\n\n      canvas.addConnection(element);\n    }\n  } else {\n    throw new Error(`unknown di for element ${semantic.id}`);\n  }\n\n  return element;\n};\n\nSagaImporter.prototype.getSource = function (semantic) {\n  return this.getShape(semantic.style.source);\n};\n\nSagaImporter.prototype.getTarget = function (semantic) {\n  return this.getShape(semantic.style.target);\n};\n\nSagaImporter.prototype.getShape = function (name) {\n  return this.elementRegistry.find((element) => element.businessObject.Name === name);\n};\n","sourceCodeStart":260,"sourceCodeEnd":295,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/saga/seata-saga-statemachine-designer/src/modeling/SagaImporter.js#L260-L295","documentation":"Thrown by SagaImporter.add when a semantic element's style.Type is neither 'Node' nor 'Edge'. The importer only knows how to materialize shapes (Node) and connections (Edge); any other DI type is rejected with the element id.","triggerScenarios":"Importing a Seata state machine JSON whose style objects carry an unexpected Type value (e.g. 'Label', 'Group', a typo like 'node', or a missing Type causing undefined) via SagaImporter.importDefinitions.","commonSituations":"Hand-edited or machine-generated state machine JSON with wrong style.Type casing/values; files produced by a newer/older designer version with new element types; JSON exported from a different tool.","solutions":["Inspect the JSON element with the reported id and check its style.Type value.","Normalize style.Type to exactly 'Node' or 'Edge' (capital first letter) for every element before import.","Remove unsupported element kinds (labels, groups) from the file and re-import.","If the file came from another designer version, re-export it from a matching designer version."],"exampleFix":"// before: { \"id\": \"e1\", \"style\": { \"Type\": \"label\", ... } }\n// after:  { \"id\": \"e1\", \"style\": { \"Type\": \"Node\", \"bounds\": { \"x\":100,\"y\":100,\"width\":80,\"height\":60 } } }","handlingStrategy":"validation","validationCode":"function hasKnownDiTypes(definitionsJson) {\n  const els = Object.values(definitionsJson.States || {}).concat(definitionsJson.edge ? [definitionsJson.edge] : []);\n  return els.every(el => el && (el.style.Type === 'Node' || el.style.Type === 'Edge'));\n}\n// run before importer.importDefinitions(definitionsJson)","typeGuard":"function isSupportedDiType(style) {\n  return style != null && (style.Type === 'Node' || style.Type === 'Edge');\n}","tryCatchPattern":"eventBus.on('import.done', (event) => {\n  if (event.error && /unknown di for element/.test(event.error.message)) {\n    // report the offending element id and skip it; the importer already logs via console.error\n  }\n});","preventionTips":["Schema-validate imported JSON: style.Type must be exactly 'Node' or 'Edge'.","Only load files produced by the matching designer version.","Keep a canonical example state machine JSON and diff unknown files against it."],"tags":["saga","statemachine","designer","import","json"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}