diff --git a/src/lang/queryAst.ts b/src/lang/queryAst.ts index 19d1b3b1a6e..bc2ac9ad5e5 100644 --- a/src/lang/queryAst.ts +++ b/src/lang/queryAst.ts @@ -1149,8 +1149,15 @@ export function getVariableExprsFromSelection( } // No variable case - exprs.push(createPipeSubstitution()) - pathIfPipe = s.codeRef.pathToNode + if (s.codeRef.pathToNode.length > 0) { + exprs.push(createPipeSubstitution()) + pathIfPipe = s.codeRef.pathToNode + continue + } + + // @pierremtb: not having a pathToNode at this point could mean the selection + // is from an imported module, see https://github.com/KittyCAD/modeling-app/issues/8616 + console.warn('No match for selection, likely a bug (or bad selection)', s) } if (exprs.length === 0) {