Fix NoneType subscript error in record_run
- Add get_asset_by_name_tx for transaction-aware asset lookup - Use transaction connection instead of separate connection - Prevents race condition where asset might not be visible Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2194,8 +2194,8 @@ async def record_run(req: RecordRunRequest, user: User = Depends(get_required_us
|
||||
await db.create_asset_tx(conn, input_asset)
|
||||
|
||||
# Check if output already exists (by content_hash) - return existing if so
|
||||
if await db.asset_exists_by_name_tx(conn, output_hash):
|
||||
existing = await db.get_asset(output_hash)
|
||||
existing = await db.get_asset_by_name_tx(conn, output_hash)
|
||||
if existing:
|
||||
logger.info(f"record_run: Output {output_hash[:16]}... already exists")
|
||||
return {"asset": existing, "activity": None, "existing": True}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user