Bug Description
CLI multi-color slicing crashes with an access violation (exit code -1073741819) in DynamicPrintConfig::update_values_to_printer_extruders_for_multiple_filaments() in PrintConfig.cpp when using the P1S 0.4mm nozzle profile. The crash occurs after slicing completes successfully, during the post-slicing update_filament_maps_to_config step.
Root Cause (from source analysis)
The P1S profile has extruder_variant_list: ["Direct Drive Standard", "Direct Drive High Flow"], which causes support_different_extruders() to return true (2 unique variants). This triggers the multi-extruder code path in update_values_to_printer_extruders_for_multiple_filaments().
At line 8463 of PrintConfig.cpp:
std::vector<int> filament_maps = printer_config.option<ConfigOptionInts>("filament_map")->values;
The filament_map option is not initialized in CLI mode (it's set dynamically by the GUI). The option<ConfigOptionInts>() returns null, and ->values dereferences a null pointer.
Similarly, extruder_type and nozzle_volume_type are accessed without null checks at lines 8472-8473.
Note: OrcaSlicer's main branch has added null checks for these fields, but the crash still occurs — possibly in get_index_for_extruder() or during the assert(false) when variant index is -1.
Reproduction
Platform: Windows 11 x86_64 (headless VM), BambuStudio v02.06.00.51
Steps:
- Create an
assemble.json:
{
"plates": [
{
"plate_name": "plate_1",
"need_arrange": true,
"objects": [
{ "path": "C:/slicer/jobs/base.stl", "count": 1, "filaments": [3], "assemble_index": [1] },
{ "path": "C:/slicer/jobs/logo.stl", "count": 1, "filaments": [4], "assemble_index": [1] },
{ "path": "C:/slicer/jobs/text.stl", "count": 1, "filaments": [1], "assemble_index": [1] }
]
}
]
}
- Run:
bambu-studio.exe \
--load-settings "machine/Bambu Lab P1S 0.4 nozzle.json;process/0.20mm Standard @BBL X1C.json" \
--load-filaments "filament/Bambu PLA Basic @BBL P1S 0.4 nozzle.json;filament/Bambu PLA Basic @BBL P1S 0.4 nozzle.json;filament/Bambu PLA Basic @BBL P1S 0.4 nozzle.json;filament/Bambu PLA Basic @BBL P1S 0.4 nozzle.json" \
--load-assemble-list assemble.json \
--slice 0 --no-check \
--export-3mf sliced.3mf
- The assembly works correctly (3 filaments detected, objects merged, wipe tower planned), slicing runs through all stages (volumes, walls, surfaces, bridges), then crashes at:
Slic3r::Print::update_filament_maps_to_config: filament maps changed after pre-slicing.
Slic3r::Print::update_filament_maps_to_config, Line 2790: extruder_count 1, extruder_volume_type_count 1
Slic3r::DynamicPrintConfig::update_values_to_printer_extruders_for_multiple_filaments, Line 8445: extruder_count 1, extruder_nozzle_volume_count 1
Slic3r::DynamicPrintConfig::update_values_to_printer_extruders_for_multiple_filaments, Line 8449: different nozzle volume processing
[ACCESS VIOLATION - exit code -1073741819]
Affected Profiles
Any printer profile with extruder_variant_list containing multiple variants (Standard + High Flow):
- Bambu Lab P1S 0.4 nozzle
- Likely also P1P, X1, X1C with similar profiles
Expected Behavior
CLI multi-color slicing with --load-assemble-list should produce a sliced 3MF with embedded G-code including tool change commands, matching what the GUI produces.
Suggested Fix
Add null checks before dereferencing filament_map, extruder_type, and nozzle_volume_type in update_values_to_printer_extruders_for_multiple_filaments() (line 8463+), similar to what OrcaSlicer added in their main branch. Additionally, ensure filament_map is initialized in CLI mode before update_filament_maps_to_config is called.
Environment
- BambuStudio v02.06.00.51 (Windows x86_64, headless)
- Also tested: BambuStudio v02.03.00.70, v02.04.00.70, v02.06.01.55 (Linux)
- Also tested: OrcaSlicer v2.2.0, v2.3.2, nightly (same crash)
- Printer: Bambu Lab P1S with AMS
Bug Description
CLI multi-color slicing crashes with an access violation (exit code -1073741819) in
DynamicPrintConfig::update_values_to_printer_extruders_for_multiple_filaments()inPrintConfig.cppwhen using the P1S 0.4mm nozzle profile. The crash occurs after slicing completes successfully, during the post-slicingupdate_filament_maps_to_configstep.Root Cause (from source analysis)
The P1S profile has
extruder_variant_list: ["Direct Drive Standard", "Direct Drive High Flow"], which causessupport_different_extruders()to returntrue(2 unique variants). This triggers the multi-extruder code path inupdate_values_to_printer_extruders_for_multiple_filaments().At line 8463 of
PrintConfig.cpp:The
filament_mapoption is not initialized in CLI mode (it's set dynamically by the GUI). Theoption<ConfigOptionInts>()returns null, and->valuesdereferences a null pointer.Similarly,
extruder_typeandnozzle_volume_typeare accessed without null checks at lines 8472-8473.Note: OrcaSlicer's
mainbranch has added null checks for these fields, but the crash still occurs — possibly inget_index_for_extruder()or during theassert(false)when variant index is -1.Reproduction
Platform: Windows 11 x86_64 (headless VM), BambuStudio v02.06.00.51
Steps:
assemble.json:{ "plates": [ { "plate_name": "plate_1", "need_arrange": true, "objects": [ { "path": "C:/slicer/jobs/base.stl", "count": 1, "filaments": [3], "assemble_index": [1] }, { "path": "C:/slicer/jobs/logo.stl", "count": 1, "filaments": [4], "assemble_index": [1] }, { "path": "C:/slicer/jobs/text.stl", "count": 1, "filaments": [1], "assemble_index": [1] } ] } ] }Affected Profiles
Any printer profile with
extruder_variant_listcontaining multiple variants (Standard + High Flow):Expected Behavior
CLI multi-color slicing with
--load-assemble-listshould produce a sliced 3MF with embedded G-code including tool change commands, matching what the GUI produces.Suggested Fix
Add null checks before dereferencing
filament_map,extruder_type, andnozzle_volume_typeinupdate_values_to_printer_extruders_for_multiple_filaments()(line 8463+), similar to what OrcaSlicer added in theirmainbranch. Additionally, ensurefilament_mapis initialized in CLI mode beforeupdate_filament_maps_to_configis called.Environment