Skip to content

Text migration fail from Jan 16 2026 #4212

@0HyperCube

Description

@0HyperCube

Text nodes created before #3643 (Jan 16 2026) such as text_old.graphite.json initially import with error. If you import the modified file again (e.g. after autosave), it then works fine.
These input types are incompatible:
• Input 1:
…found:       EditorApi<PlatformApplicationIo>
…expected: ()
• Input 3:
…found:       Font
…expected: Resource

This is because the first migration adding two parameters for max width doesn't update inputs_count

// Insert bool parameters for `has_max_width` and `has_max_height`:
// https://github.com/GraphiteEditor/Graphite/pull/3643

Preventing the second migration from running as it requires inputs_count == 13:
// Convert text nodes from the old `editor-api` scope + `Font` input to a single font `Resource` input.
// The chosen typeface is recorded as a `DataSource::Font` in the document's resource registry and loaded on open.
if reference == DefinitionIdentifier::ProtoNode(graphene_std::text::text::IDENTIFIER) && inputs_count == 13 && matches!(node.inputs.first(), Some(NodeInput::Scope(_))) {

It seems like the other migrations manually update the input count. Doing the same here resolves the issue:

diff --git a/editor/src/messages/portfolio/document_migration.rs b/editor/src/messages/portfolio/document_migration.rs
index 8f7915b7a..5f27c293e 100644
--- a/editor/src/messages/portfolio/document_migration.rs
+++ b/editor/src/messages/portfolio/document_migration.rs
@@ -1574,6 +1574,7 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
 		for i in 10..=12 {
 			document.network_interface.set_input(&InputConnector::node(*node_id, i), old_inputs[i - 2].clone(), network_path);
 		}
+		inputs_count = 13;
 	}
 
 	// Upgrade Sine, Cosine, and Tangent nodes to include a boolean input for whether the output should be in radians, which was previously the only option but is now not the default

However this seems a bit error prone (there are other places in the file that do not do this and rely on being the last migration). Perhaps retrieving the actual value each time would be better (it shouldn't have particular performance degradation I don't think)

document.document_network().nested_network(network_path).expect("network").nodes.get(node_id).expect("node").inputs.len()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions