{"record":{"id":"ef324c7198234bdf","repo":"temporalio/temporal","slug":"w-w-ef324c","errorCode":null,"errorMessage":"%w: %w","messagePattern":"%w: %w","errorType":"exception","errorClass":"Internal","httpStatus":null,"severity":"error","filePath":"service/history/statemachine_environment.go","lineNumber":256,"sourceCode":"\t\tlen(ms.GetExecutionInfo().TransitionHistory) == 0 {\n\t\t// Transtion history was disabled when the ref is generated,\n\t\t// fallback to the old validation logic.\n\t\treturn e.validateStateMachineRefWithoutTransitionHistory(ms, ref, potentialStaleState)\n\t}\n\n\terr := transitionhistory.StalenessCheck(\n\t\tms.GetExecutionInfo().GetTransitionHistory(),\n\t\tref.StateMachineRef.MutableStateVersionedTransition,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnode, err := ms.HSM().Child(ref.StateMachinePath())\n\tif err != nil {\n\t\tif errors.Is(err, hsm.ErrStateMachineNotFound) {\n\t\t\treturn fmt.Errorf(\"%w: %w\", consts.ErrStaleReference, err)\n\t\t}\n\t\treturn fmt.Errorf(\"%w: %w\", serviceerror.NewInternal(\"node lookup failed\"), err)\n\t}\n\n\tif node.InternalRepr().GetInitialVersionedTransition().TransitionCount == 0 {\n\t\t// transition history was disabled after the ref was generated and mutable state got rebuilt.\n\t\t// fallback to the old validation logic.\n\t\treturn e.validateStateMachineRefWithoutTransitionHistory(ms, ref, potentialStaleState)\n\t}\n\n\tif transitionhistory.Compare(\n\t\tref.StateMachineRef.MachineInitialVersionedTransition,\n\t\tnode.InternalRepr().GetInitialVersionedTransition(),\n\t) != 0 {\n\t\treturn fmt.Errorf(\"%w: initial versioned transition mismatch\", consts.ErrStaleReference)\n\t}\n\n\tif ref.StateMachineRef.GetMachineLastUpdateVersionedTransition().GetTransitionCount() == 0 {\n\t\t// Transition history was disabled when the node was last updated.\n\t\tif ref.Validate == nil {","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/history/statemachine_environment.go#L238-L274","documentation":"The same validateStateMachineRef path, for the failure to look up a node that DOES exist in the path but whose lookup failed for a reason other than ErrStateMachineNotFound. It wraps serviceerror.NewInternal(\"node lookup failed\") with the underlying error — an unexpected internal failure in the HSM tree traversal.","triggerScenarios":"ms.HSM().Child(ref.StateMachinePath()) returns an error that is not hsm.ErrStateMachineNotFound — e.g. malformed path, corrupt mutable state tree, or an internal persistence/deserialization problem during child traversal.","commonSituations":"Corrupted workflow mutable state after a failed upgrade or partial write; path format mismatch between code versions; bugs in HSM path construction.","solutions":["Inspect the wrapped underlying error to identify the actual lookup failure","Verify mutable state integrity for the workflow; consider replaying or resetting the workflow","Report/fix upstream if the HSM path is being constructed with an invalid format"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := env.validateStateMachineRef(ms, ref, stale)\nif err != nil {\n\tvar internal *serviceerror.Internal\n\tif errors.As(err, &internal) {\n\t\t// unexpected node lookup failure: log with wrapped cause and alert\n\t}\n\treturn err\n}","preventionTips":["Log the wrapped underlying cause — it names the real lookup failure","Keep HSM path construction and parsing in one shared, versioned helper","Add integrity checks/replay tooling for corrupt mutable state"],"tags":["go","chasm","hsm","internal"],"backgroundTag":"state-machine-node-lookup-failed","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}