OrcaSlicer icon indicating copy to clipboard operation
OrcaSlicer copied to clipboard

Unhandled unknown exception; terminating the application: Syncing and adding filament

Open bennair opened this issue 4 months ago • 5 comments

Is there an existing issue for this problem?

  • [x] I have searched the existing issues

Snapmaker_Orca Version

2.3.5

Operating System (OS)

Windows

OS Version

Windows 10

Additional system information

No response

Printer

Snapmaker U1

How to reproduce

  1. Go to device
  2. Connect printer
  3. Go to prepare tab
  4. Sync filament with printer
  5. Add filament

Actual results

Image

Expected results

Filament dropdown should have been added.

Project file & Debug log uploads

log.zip

No project file because it happens also when opening new project.

Checklist of files to include

  • [x] Log file
  • [ ] Project file

Anything else?

Image This error showing up at application startup.

bennair avatar Jul 24 '26 09:07 bennair

I have the same bug. Still experiencing the same issue on version 2.3.6.

sandwich2-code avatar Sep 01 '26 22:09 sandwich2-code

Corroborating this on macOS with a root-cause diagnosis from the logs - same machine (Snapmaker U1), same "sync filament → slots don't populate → crash" path.

Environment

  • Snapmaker Orca 2.3.6 (Build 01.10.01.50), Orca Web flutter 2.3.26
  • macOS 26.6.2
  • Snapmaker U1, firmware 1.5.2, LAN mode, 4× 0.4 mm nozzle (3 slots loaded: PETG / PLA Silk / PETG, slot 1 empty)

Two linked symptoms

1. Blank filament slots after sync. The device reports its filaments correctly (the log shows filament_type: [NONE, PETG, PLA, PETG] arriving), but the multi-filament remap then collapses everything to zero:

MF_REMAP preset_bundle old_physical=1 new_physical=0
MF_REMAP on_filaments_change new_physical=0 total_filaments=0 ... changed_map=[1->0,2->0,3->0,...]

So the Prepare slots render empty even though the printer side is fine.

2. bad lexical cast crash — including on startup. The uncaught exception is:

Error: Snapmaker Orca got an unhandled exception: bad lexical cast: source type value could not be interpreted as target
Uncaught exception: bad lexical cast: source type value could not be interpreted as target

Root cause found in Snapmaker_Orca.conf: the sync/remap writes empty strings into the numeric flush-volume fields of the active printer's preset combo:

{
    "filament": "Generic PLA",
    "filament_colors": "",
    "filament_colour_mode": "",
    "filament_multi_colors": "",
    "flush_volumes_matrix": "",
    "flush_volumes_vector": "",
    "machine": "Snapmaker U1 (0.4 nozzle)"
}

Every other combo has valid values (e.g. flush_volumes_vector: "140.000000|140.000000|...", a full 4×4 flush_volumes_matrix). On the next launch these empty strings are fed to boost::lexical_cast<float>, which throws - and because the corrupt combo reloads at startup, the app then crashes instantly at the version banner on every launch until the config is repaired.

Manually filling those four fields with valid numeric values stops the startup crash. But the app re-blanks them on the next sync, so it re-corrupts itself - i.e. the empty-flush-volume write and the total_filaments=0 remap are the same underlying bug in the multi-filament sync path.

Reproduction (matches the original report)

  1. Connect to a Snapmaker U1 in the Device tab.
  2. Prepare tab → sync filament from printer.
  3. Slots fail to populate; the remap collapses to 0 filaments.
  4. The combo's flush-volume fields are written empty → next launch throws bad lexical cast and the app crashes on startup.

Suggested fix direction

Guard the flush-volume (and color-mode) parsing against empty/malformed strings before the lexical_cast, and fix the remap so a 4-slot device that reports N loaded filaments doesn't collapse to total_filaments=0.

Happy to attach full logs if useful.

DropDOS avatar Sep 17 '26 15:09 DropDOS

Opened #876 with a fix for the crash side of this. The flush volume parsing was throwing on empty values instead of skipping them, so an empty flush_volumes_matrix/vector took down the whole preset load (and the startup crash after). Doesn't fix why the sync writes the empty values in the first place, but it stops the hard crash.

DropDOS avatar Sep 17 '26 17:09 DropDOS

Update, root cause confirmed on a U1 and both symptoms reproduced live this session.

Sync uses a cached filament snapshot and does not read the machine at sync time. Filament presence is motion sensor based per slot, so slots read empty during runouts and loads, and the cache can be stale for a long time. Two symptoms fall out of that same cause:

The crash: a stale snapshot with an empty slot, a small project, the count collapses to zero, empty flush volumes get written, bad lexical cast. Guarded by #876.

Wrong count with no crash: all four slots loaded on the machine, three filaments in the project, sync returned three and silently dropped the fourth. The overwrite path sizes its result to the current project count rather than the machine.

Fixes for the collector count and for reading the machine live at sync time are in testing. Repro for either: change or reload a filament from the machine, then sync from the slicer before it has refreshed, and use a project whose filament count differs from the machine.

DropDOS avatar Sep 17 '26 21:09 DropDOS

This is already fixed by open PR #876 (same root cause: empty flush_volumes strings fed to boost::lexical_cast in update_selections/load_selections). I verified the fix independently against v2.4.1 and was about to submit a duplicate PR — not submitting one, linking #876 here instead.

creat3dworld avatar Nov 14 '26 05:11 creat3dworld