You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "aglinxinyuan (via GitHub)" <gi...@apache.org> on 2026/08/10 00:40:25 UTC
[I] A falsy throw from the model makes sendMessage reject instead of reporting an error step [texera]
aglinxinyuan opened a new issue, #7485:
URL: https://github.com/apache/texera/issues/7485
### What happened?
`TexeraAgent.sendMessage` is written to never reject: every failure is turned into an error step and returned as `{ error }` on the resolved `AgentMessageResult`. One path breaks that contract.
The catch block reads `.name` off the caught value without guarding it:
```ts
// texera-agent.ts:659-660
} catch (error: any) {
const isAborted = error.name === "AbortError" || this.abortController?.signal.aborted;
```
If the value thrown is `null` or `undefined`, that line throws a `TypeError` *inside* the catch, so it propagates out and **`sendMessage` rejects** instead of resolving. Callers that only handle the documented resolved shape get an unhandled rejection, and the turn leaves no error step behind — the failure is invisible in the ReAct history.
Confirmed against `main`:
```
TypeError: null is not an object (evaluating 'error.name')
```
with the returned value `undefined` (the promise rejected rather than resolving).
The same line is the only place in the method that dereferences the caught value before it has been normalized; every other use goes through `error instanceof Error ? error.message : String(error)`, which already handles this correctly.
### How to reproduce?
Drive the agent with a model that throws a falsy value:
```ts
const model = new MockLanguageModelV4({
doGenerate: async () => {
throw null;
},
});
const agent = new TexeraAgent({ model, modelType: "m", agentId: "a", systemPrompt: "s" });
await agent.sendMessage("hi");
// rejects with TypeError: null is not an object (evaluating 'error.name')
// expected: resolves with { error: "null", stopped: false }
```
`MockLanguageModelV4` comes from the `ai/test` export, so this needs no network.
### Version/Branch
1.3.0-incubating-SNAPSHOT (main)
### Expected behavior
The catch should normalize before inspecting, e.g.
```ts
const isAborted = (error as any)?.name === "AbortError" || this.abortController?.signal.aborted;
```
so that a falsy throw takes the ordinary error-step path and `sendMessage` keeps its promise never to reject.
### Additional context
Found while raising `texera-agent.ts` coverage from 51% to 99.8%. A provider throwing `null` is uncommon, so the practical impact is low — but the cost of the fix is one optional-chain, and the current behaviour is the single exception to an otherwise total contract.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] A falsy throw from the model makes sendMessage reject instead of reporting an error step [texera]
Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan closed issue #7485: A falsy throw from the model makes sendMessage reject instead of reporting an error step
URL: https://github.com/apache/texera/issues/7485
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] A falsy throw from the model makes sendMessage reject instead of reporting an error step [texera]
Posted by "anthonychengit (via GitHub)" <gi...@apache.org>.
anthonychengit commented on issue #7485:
URL: https://github.com/apache/texera/issues/7485#issuecomment-5287269123
/take
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] A falsy throw from the model makes sendMessage reject instead of reporting an error step [texera]
Posted by "Raja-Hamid (via GitHub)" <gi...@apache.org>.
Raja-Hamid commented on issue #7485:
URL: https://github.com/apache/texera/issues/7485#issuecomment-5254824129
/take
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] A falsy throw from the model makes sendMessage reject instead of reporting an error step [texera]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #7485:
URL: https://github.com/apache/texera/issues/7485#issuecomment-5234717461
<!-- texera:template-compliance -->
👋 Thanks for opening this issue, @aglinxinyuan!
It looks like the issue description doesn't quite follow our template yet:
- This issue doesn't appear to use one of our templates (Bug, Feature, or Task). Please open it using a template so the required details are captured.
Filling out the template helps reviewers understand and triage your contribution faster. Please edit the description to complete it. This message will disappear automatically once the template is followed.
You can find the template prompts by editing the description, or see [CONTRIBUTING.md](https://github.com/apache/texera/blob/main/CONTRIBUTING.md) for the full contribution flow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org