Skip to content

Commit 75b424b

Browse files
Update postgresAgentStateService.ts
1 parent 6046cb9 commit 75b424b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/modules/postgres/postgresAgentStateService.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,8 @@ export class PostgresAgentStateService implements AgentContextService {
538538

539539
async loadIterations(agentId: string): Promise<AutonomousIteration[]> {
540540
// Load the agent first to check existence and ownership
541-
await this.load(agentId); // This will throw NotFound or NotAllowed if necessary
541+
const agent = await this.load(agentId); // This will throw NotAllowed if necessary
542+
if (!agent) throw new NotFound(`Agent with ID ${agentId} not found.`);
542543

543544
const rows = await this.db.selectFrom('agent_iterations').selectAll().where('agent_id', '=', agentId).orderBy('iteration_number', 'asc').execute();
544545

0 commit comments

Comments
 (0)