e2b-dev / e2b-dev/langchain-e2b
AsyncE2BSandbox.aedit crashes with AttributeError: '_map_edit_error' is never defined
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
AsyncE2BSandbox._aedit_inline and _aedit_via_upload (langchain_e2b/sandbox.py:598 and :669) both call:
return self._map_edit_error(data["error"], file_path, old_string)
on any edit conflict reported by the sandbox-side edit script (e.g. string_not_found, multiple_occurrences). _map_edit_error is never defined anywhere in this package (checked 0.0.1 through 0.0.6) — every edit conflict raises an uncaught AttributeError instead of returning a clean EditResult(error=...).
Repro: call await sandbox.aedit(file_path, old_string, new_string) with an old_string that doesn't exist (or matches more than once) in the target file.
AttributeError: 'AsyncE2BSandbox' object has no attribute '_map_edit_error'
This crashed a production LangGraph agent turn for us — the exception propagates straight out of the tool call with nothing to catch it.
The fix looks like a one-line omission — deepagents' own BaseSandbox (which AsyncE2BSandbox subclasses) already ships a correct free function for this exact purpose, deepagents.backends.sandbox._map_edit_error(error, file_path, old_string) -> EditResult, which maps the same error codes emitted by the shared sandbox edit script to actionable messages. AsyncE2BSandbox's override duplicates the surrounding _aedit_inline/_aedit_via_upload logic but calls self._map_edit_error(...) instead of importing and calling that free function.
Happy to open a PR with the fix if useful.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in langchain_e2b/sandbox.py at AsyncE2BSandbox._aedit_inline around line 598 and _aedit_via_upload around line 669, then compare the shared deepagents sandbox error mapping. Reproduce an edit with a missing or duplicate old_string. Done means both paths return a clean EditResult(error=...) for sandbox edit conflicts instead of raising AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100