This is an automated email from the ASF dual-hosted git repository.
tbonelee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push:
new 1e750fd145 [ZEPPELIN-2506] Improve error message when no interpreter
is bound to a note
1e750fd145 is described below
commit 1e750fd145a434c3084aee9e81a1fd354117a03e
Author: Yerin Lee <[email protected]>
AuthorDate: Mon Oct 5 14:03:12 2026 +0900
[ZEPPELIN-2506] Improve error message when no interpreter is bound to a note
### What is this PR for?
When a paragraph is executed without any interpreter bound to the note,
the error message displays "Interpreter null not found", which is confusing and
unhelpful. This PR improves the error message to clearly state "No interpreter
is bound to this note. Please check the interpreter settings." when intpText is
null or blank.
### What type of PR is it?
Bug Fix
### Todos
- [x] Improve error message in Paragraph.setInterpreterNotFound() for
null/blank intpText
- [x] Add unit tests for both null and present intpText cases
### What is the Jira issue?
- https://issues.apache.org/jira/browse/ZEPPELIN-2506
- [ZEPPELIN-2506] "Interpreter null not found" when a note is not bound
to any interpreters
### How should this be tested?
- Two unit tests added in ParagraphTest:
- testInterpreterNotFoundMessageWhenIntpTextIsNull — verifies the
improved message when no interpreter is specified
- testInterpreterNotFoundMessageWhenIntpTextIsPresent — verifies the
existing message is preserved when an invalid interpreter name is given
- Manual: create a note with no interpreter binding, run a paragraph
without %interpreter prefix, and confirm the new error message appears.
### Screenshots (if appropriate)
N/A
### Questions:
- Does the license files need to update? No
- Is there breaking changes for older versions? No
- Does this needs documentation? No
Closes #5521 from yxinot/ZEPPELIN-2506-fix-interpreter-null-not-found.
Signed-off-by: ChanHo Lee <[email protected]>
---
.../org/apache/zeppelin/notebook/Paragraph.java | 10 ++++++--
.../apache/zeppelin/notebook/ParagraphTest.java | 29 ++++++++++++++++++++++
2 files changed, 37 insertions(+), 2 deletions(-)
diff --git
a/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
b/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
index de9382150c..deb5dd401f 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
@@ -843,9 +843,15 @@ public class Paragraph extends
JobWithProgressPoller<InterpreterResult> implemen
}
public void setInterpreterNotFound(InterpreterNotFoundException e) {
+ String message;
+ if (StringUtils.isBlank(this.intpText)) {
+ message = "No interpreter is bound to this note. "
+ + "Please check the interpreter settings.";
+ } else {
+ message = String.format("Interpreter %s not found", this.intpText);
+ }
InterpreterResult intpResult =
- new InterpreterResult(InterpreterResult.Code.ERROR,
- String.format("Interpreter %s not found", this.intpText));
+ new InterpreterResult(InterpreterResult.Code.ERROR, message);
setReturn(intpResult, e);
setStatus(Job.Status.ERROR);
}
diff --git
a/zeppelin-server/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java
b/zeppelin-server/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java
index 869d5622fc..f00815e265 100644
---
a/zeppelin-server/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java
+++
b/zeppelin-server/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java
@@ -406,4 +406,33 @@ class ParagraphTest extends AbstractInterpreterTest {
verify(mockInterpreter, times(2)).interpret(eq("val x =
\"usr=user&pass=pwd\""), any(InterpreterContext.class));
}
+
+ @Test
+ void testInterpreterNotFoundMessageWhenIntpTextIsNull() {
+ Note note = createNote();
+ Paragraph paragraph = new Paragraph(note, null);
+ // When no interpreter is specified, intpText is empty
+ paragraph.setText("some code without interpreter");
+ paragraph.setInterpreterNotFound(
+ new
org.apache.zeppelin.interpreter.InterpreterNotFoundException("test"));
+
+ InterpreterResult result = paragraph.getReturn();
+ assertEquals(Code.ERROR, result.code());
+ assertEquals("No interpreter is bound to this note. "
+ + "Please check the interpreter settings.",
+ result.message().get(0).getData());
+ }
+
+ @Test
+ void testInterpreterNotFoundMessageWhenIntpTextIsPresent() {
+ Note note = createNote();
+ Paragraph paragraph = new Paragraph(note, null);
+ paragraph.setText("%invalid some code");
+ paragraph.setInterpreterNotFound(
+ new
org.apache.zeppelin.interpreter.InterpreterNotFoundException("test"));
+
+ InterpreterResult result = paragraph.getReturn();
+ assertEquals(Code.ERROR, result.code());
+ assertEquals("Interpreter invalid not found",
result.message().get(0).getData());
+ }
}