apache/incubator-seata · error · Error
Export failed: Unable to resolve source state '${source}' fo
Error message
Export failed: Unable to resolve source state '${source}' for edge targeting '${target}'. What it means
Thrown by SagaExporter.parseEdge when an edge has a source Name but definitions.States has no entry for it. During export, every state is registered in definitions.States keyed by its Name (parseState); an edge referencing a source not in that map means the graph references a state the exporter never processed.
Source
Thrown at saga/seata-saga-statemachine-designer/src/modeling/SagaExporter.js:72
target = edge.target.businessObject.Name;
elementJson.style.target = target;
}
if (!source) {
if (definitions.StartState) {
throw new Error(`Two or more start states, ${target} and ${definitions.StartState}`);
} else {
definitions.StartState = target;
if (definitions.edge === undefined) {
definitions.edge = {};
}
assign(definitions.edge, elementJson);
}
} else {
const stateRef = definitions.States[source];
if (!stateRef) {
throw new Error(`Export failed: Unable to resolve source state '${source}' for edge targeting '${target}'.`);
}
switch (businessObject.Type) {
case 'ChoiceEntry':
if (!stateRef.Choices) {
stateRef.Choices = [];
}
stateRef.Choices.push({
Expression: businessObject.Expression,
Next: target,
});
if (businessObject.Default) {
stateRef.Default = target;
}
stateRef.edge = assign(stateRef.edge || {}, { [target]: elementJson });
break;
case 'ExceptionMatch':
if (!stateRef.Catch) {View on GitHub (pinned to e01f97c6db)
Solutions
- Re-attach the failing edge to an existing, named state in the designer.
- Check for leftover edges of deleted states (select-all around the area or inspect elementRegistry) and delete them.
- If a state was renamed, update the edge source to the new Name (redraw the connection).
- Inspect the diagram JSON and make sure every edge's style.source matches a States key exactly (case-sensitive).
Example fix
// before: state 'SubmitOrder' renamed to 'SubmitOrderTask', edge still points at old name // elementJson.style.source === 'SubmitOrder' -> definitions.States['SubmitOrder'] === undefined // after: redraw the edge from 'SubmitOrderTask' so style.source matches the state Name
Defensive patterns
Strategy: validation
Validate before calling
function allEdgeSourcesResolve(elementRegistry) {
const stateNames = new Set(
elementRegistry.getAll()
.filter(el => el.businessObject instanceof State)
.map(el => el.businessObject.Name)
);
return elementRegistry.getAll()
.filter(el => el.businessObject instanceof Edge)
.every(e => !e.source || stateNames.has(e.source.businessObject && e.source.businessObject.Name));
} Type guard
function isResolvedState(definitions, name) {
return Boolean(name) && Object.prototype.hasOwnProperty.call(definitions.States, name);
} Try / catch
try {
exporter.export();
} catch (e) {
if (/Unable to resolve source state/.test(e.message)) {
// extract source/target from message and highlight the dangling edge in the UI
}
throw e;
} Prevention
- Delete edges together with the states they connect (designer should orphan-check on element delete).
- Validate that every edge's style.source matches an existing state Name before saving.
- Treat state renames as a refactor: update all referencing edges atomically.
When it happens
Trigger: Calling export() when an edge's source businessObject.Name refers to a state that was deleted, renamed after the edge was drawn, or whose businessObject is not an instance of the State spec class filtered in export().
Common situations: Renaming a state in the designer after connecting edges to it; deleting a state without deleting its edges; a corrupted or hand-edited diagram file where edge style.source does not match any state Name.
Related errors
- Two or more start states, ${target} and ${definitions.StartS
- unknown di for element ${semantic.id}
- datasource required not null!
- Cannot convert {name}
- Cannot convert {name}
AI-assisted analysis of apache/incubator-seata@e01f97c6db (2026-08-14).
Data as JSON: /api/errors/cc399bbc7453ec62.
Report an issue: GitHub.