{"record":{"id":"8d85fff48c4af16b","repo":"temporalio/temporal","slug":"failed-to-encode-chasm-path-on-clean-tree-v","errorCode":null,"errorMessage":"failed to encode chasm path on clean tree: %v","messagePattern":"failed to encode chasm path on clean tree: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"chasm/tree.go","lineNumber":2538,"sourceCode":"\tn.snapshotInternal(exclusiveMinVT, nodes)\n\n\treturn NodesSnapshot{\n\t\tNodes: nodes,\n\t}\n}\n\nfunc (n *Node) snapshotInternal(\n\texclusiveMinVT *persistencespb.VersionedTransition,\n\tnodes map[string]*persistencespb.ChasmNode,\n) {\n\tif n == nil {\n\t\treturn\n\t}\n\n\tif transitionhistory.Compare(n.serializedNode.Metadata.LastUpdateVersionedTransition, exclusiveMinVT) > 0 {\n\t\tencodedPath, err := n.getEncodedPath()\n\t\tif !softassert.That(n.logger, err == nil, \"chasm path encoding should always succeed on clean tree\") {\n\t\t\tpanic(fmt.Sprintf(\"failed to encode chasm path on clean tree: %v\", err))\n\t\t}\n\t\tnodes[encodedPath] = n.serializedNode\n\t}\n\n\tfor _, childNode := range n.children {\n\t\tchildNode.snapshotInternal(\n\t\t\texclusiveMinVT,\n\t\t\tnodes,\n\t\t)\n\t}\n}\n\n// PartitionedSnapshot returns the tree's state split into two parts:\n//   - A NodesSnapshot with cluster-local fields (physical task statuses) zeroed, safe to\n//     upload to object storage or replicate to another cluster.\n//   - A ChasmLocalState capturing the extracted cluster-local fields, keyed by encoded\n//     node path. Only nodes that carry such metadata are present.\n//","sourceCodeStart":2520,"sourceCodeEnd":2556,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/chasm/tree.go#L2520-L2556","documentation":"During Snapshot's internal walk (snapshotInternal), a node whose LastUpdateVersionedTransition is newer than exclusiveMinVT must be included in the snapshot, which requires encoding the node's tree path. Path encoding should never fail on a clean (fully serialized) tree; if getEncodedPath() returns an error, the tree is in an unexpected state, so the code panics with the error. This is an internal-invariant panic indicating corrupted or inconsistent tree serialization state.","triggerScenarios":"Calling Node.Snapshot() (on a root, clean tree) where a node's serializedNode exists and its LastUpdateVersionedTransition is > exclusiveMinVT, but getEncodedPath() returns an error — e.g. an empty/invalid path, missing component metadata, or a node not fully serialized.","commonSituations":"Persistence corruption or a partially written CHASM tree row set; framework bug where a node was mutated without proper serialization before snapshot; snapshotting a tree with nodes in an intermediate/dirty state the IsDirty guard didn't catch.","solutions":["Treat as a bug report: capture the node/path details from the panic message and file an issue with the workflow execution context","Check for persistence anomalies (missing/partial chasm node rows) for the affected execution","Ensure Snapshot is only called when the tree is committed/clean (per the API contract)","Retry after the tree is next persisted, if the state was transient mid-mutation"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"defer func() {\n    if r := recover(); r != nil {\n        if s, ok := r.(string); ok && strings.Contains(s, \"failed to encode chasm path\") {\n            // fall back to re-fetching/persisting the tree; report bug\n            return\n        }\n        panic(r)\n    }\n}()","preventionTips":["Only snapshot clean, committed trees per the API contract","Monitor for persistence anomalies in chasm node rows","Escalate occurrences as framework/persistence bugs with node details"],"tags":["chasm","tree","snapshot","panic","internal-invariant"],"backgroundTag":"path-encoding-failed","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}