Repository navigation
CLI segfaults slicing any 3MF: expand_plate_extruders() calls wxGetApp() in CLI mode #935
Description
Is there an existing issue for this problem?
- I have searched the existing issues
(Related but different: #689 is the crash when loading a process preset; this one is the crash when the input is a 3MF, with valid presets.)
Snapmaker_Orca Version
2.4.0 (the CLI reports engine version 01.10.01.50)
Operating System (OS)
macOS
OS Version
macOS 26.5.2 (25F84)
Additional system information
Apple Silicon (arm64). Command line only, no GUI involved.
Printer
Snapmaker U1 (0.4 nozzle)
How to reproduce
- Take any project 3MF. Tested with (a) a project saved by the 2.4.0 GUI and (b) a 3MF the CLI itself had just exported from a 20 mm cube STL with
--export-3mf. - Run:
Snapmaker_Orca --debug 5 --allow-newer-file --slice 0 --outputdir /abs/path/out /abs/path/project.3mf
Actual results
Segfault (SIGSEGV, exit 139), no gcode. The log ends with:
check_plate_wipe_tower begin plate=1 has_wipe_tower_x=true smooth_timelapse=false
check_plate_wipe_tower printable instances plate=1 valid_count=1
check_plate_wipe_tower print sequence plate=1 is_sequence=false
PartPlate::get_extruders_under_cli begin plate=0 obj_to_instance_count=1 consider_custom_gcode=true
PartPlate::get_extruders_under_cli object plate=0 obj_id=0 instance_id=0 volume_count=1 printable=true
PartPlate::get_extruders_under_cli skipping custom gcode scan in CLI path plate=0
The next line that function would log, get_extruders_under_cli result (src/slic3r/GUI/PartPlate.cpp:1610 at v2.4.0), is never written. Between the two there is only a sort/unique and expand_plate_extruders(plate_extruders) (line 1603):
static void expand_plate_extruders(std::vector<int>& ids)
{
const size_t num_physical = static_cast<size_t>(std::max(wxGetApp().filaments_cnt(), 0));
if (num_physical > 0) {
wxGetApp().preset_bundle->mixed_filaments.expand_virtual_extruder_ids(ids, num_physical);wxGetApp() is the GUI_App singleton, and there isn't one in CLI mode. Call chain:
Snapmaker_Orca.cpp:3352 check_plate_wipe_tower() → PartPlate::get_extruders_under_cli() → expand_plate_extruders() → wxGetApp()
check_plate_wipe_tower() runs for every input that carries plate data (if (plate_data_src.size() > 0), line 3343), so every project 3MF crashes. STL input never reaches it, and STL slicing works fine with the same presets. Removing wipe_tower_x from the project config doesn't avoid it, because the CLI's config is seeded with defaults (has_wipe_tower_x=true either way).
calc_exclude_triangles: Unable to create exclude triangles is also logged just before, but it is logged on successful STL slices too, so it is not the cause.
Without --allow-newer-file the same command exits 232 first:
Version Check: File Version 2.4.0.0 not supported by current cli version 01.10.01.50
The CLI compares the file's app version (2.4.0) against the engine version (01.10.01.50), so it rejects a 3MF it wrote itself a second earlier.
Expected results
The 3MF slices as it does in the GUI, and a 2.4.0 CLI accepts a 3MF written by 2.4.0 without --allow-newer-file.
A possible fix: in the CLI path, don't go through wxGetApp(). get_extruders_under_cli() already receives full_config, so it could pass the physical filament count (e.g. the size of filament_colour) into the expansion. Or it could skip the virtual-id expansion when wxTheApp is null. expand_plate_extruders doesn't exist in upstream OrcaSlicer (it came with Color Mixing), and it is already present in V2.3.6.
Project file & Debug log uploads
The crash reproduces with any 3MF, including one the CLI exports from a plain cube STL, so there's no specific project needed. The log excerpt above is from --debug 5, and I can attach the full log and the 3MF if useful.
Checklist of files to include
- Log file (excerpt above)
- Project file
Anything else?
Two related observations, in case they help:
- Stripping the plate data is not a workaround. With the
<plate>blocks removed fromMetadata/model_settings.config, the 3MF slices, but the per-objectextrudermetadata is silently ignored. A two-object, two-filament project printed entirely with filament 1 (; filament used [g] = 6.35, 0.00), with the prime tower disabled. --load-assemble-listalso segfaults. I used STLs assembled into one multi-part object with per-partfilaments. The crash comes right aftercreate_plate:created a new plate 0. I did not trace this one, but it may be the same class of GUI dependency.
Activity
emretepedev commentedon Oct 13, 2026
same issue here