[GH-ISSUE #676] [Bug Report] When logging into Bambuddy with any account not in the "Viewer" group, the AMS d #447

Closed
opened 2026-05-06 12:29:36 +02:00 by BreizhHardware · 7 comments

Originally created by @maziggy on GitHub (Mar 12, 2026).
Original GitHub issue: https://github.com/maziggy/bambuddy/issues/676

Originally assigned to: @maziggy on GitHub.

When logging into Bambuddy with any account not in the "Viewer" group, the AMS displays 0% quantity for most filaments. When logging in as a "Viewer", the qty displays correctly.

System Information
{
  "generated_at": "2026-03-12T08:57:49.226248",
  "app": {
    "version": "0.2.2b3",
    "debug_mode": false
  },
  "system": {
    "platform": "Windows",
    "platform_release": "11",
    "platform_version": "10.0.26100",
    "architecture": "AMD64",
    "python_version": "3.14.2"
  },
  "environment": {
    "docker": false,
    "data_dir": "C:\\bambuddy",
    "log_dir": "C:\\bambuddy\\logs",
    "timezone": ""
  },
  "database": {
    "archives_total": 4,
    "archives_completed": 0,
    "printers_total": 7,
    "filaments_total": 0,
    "projects_total": 0,
    "smart_plugs_total": 0
  },
  "printers": [
    {
      "index": 1,
      "model": "H2D Pro",
      "nozzle_count": 2,
      "is_active": true,
      "mqtt_connected": true,
      "state": "FINISH",
      "firmware_version": "01.01.00.00",
      "wifi_signal": -90,
      "reachable": true,
      "ams_unit_count": 8,
      "ams_tray_count": 20,
      "has_vt_tray": true,
      "external_camera_configured": false,
      "plate_detection_enabled": false,
      "hms_error_count": 1,
      "developer_mode": true,
      "nozzle_rack_count": 2
    },
    {
      "index": 2,
      "model": "H2D Pro",
      "nozzle_count": 2,
      "is_active": true,
      "mqtt_connected": true,
      "state": "IDLE",
      "firmware_version": "01.01.00.00",
      "wifi_signal": -90,
      "reachable": true,
      "ams_unit_count": 8,
      "ams_tray_count": 20,
      "has_vt_tray": true,
      "external_camera_configured": false,
      "plate_detection_enabled": false,
      "hms_error_count": 0,
      "developer_mode": true,
      "nozzle_rack_count": 2
    },
    {
      "index": 3,
      "model": "H2D Pro",
      "nozzle_count": 2,
      "is_active": true,
      "mqtt_connected": true,
      "state": "IDLE",
      "firmware_version": "01.01.00.00",
      "wifi_signal": -90,
      "reachable": true,
      "ams_unit_count": 8,
      "ams_tray_count": 17,
      "has_vt_tray": true,
      "external_camera_configured": false,
      "plate_detection_enabled": false,
      "hms_error_count": 0,
      "developer_mode": true,
      "nozzle_rack_count": 2
    },
    {
      "index": 4,
      "model": "X1E",
      "nozzle_count": 1,
      "is_active": true,
      "mqtt_connected": true,
      "state": "RUNNING",
      "firmware_version": "01.02.02.00",
      "wifi_signal": -90,
      "reachable": true,
      "ams_unit_count": 1,
      "ams_tray_count": 4,
      "has_vt_tray": true,
      "external_camera_configured": false,
      "plate_detection_enabled": false,
      "hms_error_count": 0,
      "developer_mode": true,
      "nozzle_rack_count": 1
    },
    {
      "index": 5,
      "model": "X1E",
      "nozzle_count": 1,
      "is_active": true,
      "mqtt_connected": true,
      "state": "RUNNING",
      "firmware_version": "01.02.02.00",
      "wifi_signal": -90,
      "reachable": true,
      "ams_unit_count": 1,
      "ams_tray_count": 3,
      "has_vt_tray": true,
      "external_camera_configured": false,
      "plate_detection_enabled": false,
      "hms_error_count": 0,
      "developer_mode": true,
      "nozzle_rack_count": 1
    },
    {
      "index": 6,
      "model": "X1E",
      "nozzle_count": 1,
      "is_active": true,
      "mqtt_connected": true,
      "state": "RUNNING",
      "firmware_version": "01.02.02.00",
      "wifi_signal": -90,
      "reachable": true,
      "ams_unit_count": 1,
      "ams_tray_count": 4,
      "has_vt_tray": true,
      "external_camera_configured": false,
      "plate_detection_enabled": false,
      "hms_error_count": 0,
      "developer_mode": true,
      "nozzle_rack_count": 1
    },
    {
      "index": 7,
      "model": "X1E",
      "nozzle_count": 1,
      "is_active": true,
      "mqtt_connected": true,
      "state": "FINISH",
      "firmware_version": "01.02.02.00",
      "wifi_signal": -90,
      "reachable": true,
      "ams_unit_count": 1,
      "ams_tray_count": 3,
      "has_vt_tray": true,
      "external_camera_configured": false,
      "plate_detection_enabled": false,
      "hms_error_count": 0,
      "developer_mode": true,
      "nozzle_rack_count": 1
    }
  ],
  "settings": {
    "auth_enabled": "true",
    "setup_completed": "true",
    "auto_archive": "true",
    "save_thumbnails": "true",
    "capture_finish_photo": "true",
    "default_filament_cost": "25.0",
    "currency": "USD",
    "energy_cost_per_kwh": "0.15",
    "energy_tracking_mode": "total",
    "check_updates": "true",
    "check_printer_firmware": "true",
    "include_beta_updates": "false",
    "notification_language": "en",
    "bed_cooled_threshold": "35.0",
    "ams_humidity_good": "40",
    "ams_humidity_fair": "60",
    "ams_temp_good": "28.0",
    "ams_temp_fair": "35.0",
    "ams_history_retention_days": "30",
    "per_printer_mapping_expanded": "false",
    "date_format": "us",
    "time_format": "system",
    "default_printer_id": "None",
    "ftp_retry_enabled": "true",
    "ftp_retry_count": "3",
    "ftp_retry_delay": "2",
    "ftp_timeout": "30",
    "mqtt_enabled": "false",
    "mqtt_broker": "",
    "mqtt_port": "1883",
    "mqtt_topic_prefix": "bambuddy",
    "mqtt_use_tls": "false",
    "ha_enabled": "false",
    "library_archive_mode": "ask",
    "library_disk_warning_gb": "5.0",
    "camera_view_mode": "embedded",
    "preferred_slicer": "bambu_studio",
    "prometheus_enabled": "false",
    "dark_accent": "orange",
    "light_accent": "orange",
    "advanced_auth_enabled": "true",
    "smtp_host": "smtphub.corning.com",
    "smtp_port": "25",
    "smtp_from_name": "3D Print Farm",
    "smtp_security": "none",
    "smtp_auth_enabled": "false",
    "smtp_use_tls": "true",
    "spoolman_enabled": "false",
    "spoolman_sync_mode": "auto",
    "spoolman_disable_weight_sync": "false",
    "spoolman_report_partial_usage": "true"
  },
  "virtual_printers": [],
  "integrations": {
    "notification_providers": [],
    "spoolman": {
      "enabled": false,
      "reachable": false
    },
    "mqtt_relay": {
      "enabled": false,
      "connected": false,
      "broker": "",
      "port": 0,
      "topic_prefix": "bambuddy"
    },
    "homeassistant": {
      "enabled": false
    }
  },
  "database_health": {
    "journal_mode": "wal",
    "quick_check": "ok",
    "db_size_bytes": 3235840,
    "wal_size_bytes": 4284832
  },
  "dependencies": {
    "fastapi": "0.135.1",
    "uvicorn": "0.41.0",
    "pydantic": "2.12.5",
    "sqlalchemy": "2.0.48",
    "paho-mqtt": "2.1.0",
    "psutil": "7.2.2",
    "httpx": "0.28.1",
    "aiofiles": "25.1.0",
    "cryptography": "46.0.5",
    "opencv-python-headless": "4.13.0.92",
    "numpy": "2.4.3"
  },
  "log_file": {
    "size_bytes": 2906311,
    "size_formatted": "2.8 MB"
  },
  "network": {
    "interface_count": 0,
    "interfaces": []
  },
  "websockets": {
    "active_connections": 4
  }
}

Logs (sanitized): bambuddy.log


Submitted via BamBuddy Bug Report

Originally created by @maziggy on GitHub (Mar 12, 2026). Original GitHub issue: https://github.com/maziggy/bambuddy/issues/676 Originally assigned to: @maziggy on GitHub. When logging into Bambuddy with any account not in the "Viewer" group, the AMS displays 0% quantity for most filaments. When logging in as a "Viewer", the qty displays correctly. <details> <summary>System Information</summary> ```json { "generated_at": "2026-03-12T08:57:49.226248", "app": { "version": "0.2.2b3", "debug_mode": false }, "system": { "platform": "Windows", "platform_release": "11", "platform_version": "10.0.26100", "architecture": "AMD64", "python_version": "3.14.2" }, "environment": { "docker": false, "data_dir": "C:\\bambuddy", "log_dir": "C:\\bambuddy\\logs", "timezone": "" }, "database": { "archives_total": 4, "archives_completed": 0, "printers_total": 7, "filaments_total": 0, "projects_total": 0, "smart_plugs_total": 0 }, "printers": [ { "index": 1, "model": "H2D Pro", "nozzle_count": 2, "is_active": true, "mqtt_connected": true, "state": "FINISH", "firmware_version": "01.01.00.00", "wifi_signal": -90, "reachable": true, "ams_unit_count": 8, "ams_tray_count": 20, "has_vt_tray": true, "external_camera_configured": false, "plate_detection_enabled": false, "hms_error_count": 1, "developer_mode": true, "nozzle_rack_count": 2 }, { "index": 2, "model": "H2D Pro", "nozzle_count": 2, "is_active": true, "mqtt_connected": true, "state": "IDLE", "firmware_version": "01.01.00.00", "wifi_signal": -90, "reachable": true, "ams_unit_count": 8, "ams_tray_count": 20, "has_vt_tray": true, "external_camera_configured": false, "plate_detection_enabled": false, "hms_error_count": 0, "developer_mode": true, "nozzle_rack_count": 2 }, { "index": 3, "model": "H2D Pro", "nozzle_count": 2, "is_active": true, "mqtt_connected": true, "state": "IDLE", "firmware_version": "01.01.00.00", "wifi_signal": -90, "reachable": true, "ams_unit_count": 8, "ams_tray_count": 17, "has_vt_tray": true, "external_camera_configured": false, "plate_detection_enabled": false, "hms_error_count": 0, "developer_mode": true, "nozzle_rack_count": 2 }, { "index": 4, "model": "X1E", "nozzle_count": 1, "is_active": true, "mqtt_connected": true, "state": "RUNNING", "firmware_version": "01.02.02.00", "wifi_signal": -90, "reachable": true, "ams_unit_count": 1, "ams_tray_count": 4, "has_vt_tray": true, "external_camera_configured": false, "plate_detection_enabled": false, "hms_error_count": 0, "developer_mode": true, "nozzle_rack_count": 1 }, { "index": 5, "model": "X1E", "nozzle_count": 1, "is_active": true, "mqtt_connected": true, "state": "RUNNING", "firmware_version": "01.02.02.00", "wifi_signal": -90, "reachable": true, "ams_unit_count": 1, "ams_tray_count": 3, "has_vt_tray": true, "external_camera_configured": false, "plate_detection_enabled": false, "hms_error_count": 0, "developer_mode": true, "nozzle_rack_count": 1 }, { "index": 6, "model": "X1E", "nozzle_count": 1, "is_active": true, "mqtt_connected": true, "state": "RUNNING", "firmware_version": "01.02.02.00", "wifi_signal": -90, "reachable": true, "ams_unit_count": 1, "ams_tray_count": 4, "has_vt_tray": true, "external_camera_configured": false, "plate_detection_enabled": false, "hms_error_count": 0, "developer_mode": true, "nozzle_rack_count": 1 }, { "index": 7, "model": "X1E", "nozzle_count": 1, "is_active": true, "mqtt_connected": true, "state": "FINISH", "firmware_version": "01.02.02.00", "wifi_signal": -90, "reachable": true, "ams_unit_count": 1, "ams_tray_count": 3, "has_vt_tray": true, "external_camera_configured": false, "plate_detection_enabled": false, "hms_error_count": 0, "developer_mode": true, "nozzle_rack_count": 1 } ], "settings": { "auth_enabled": "true", "setup_completed": "true", "auto_archive": "true", "save_thumbnails": "true", "capture_finish_photo": "true", "default_filament_cost": "25.0", "currency": "USD", "energy_cost_per_kwh": "0.15", "energy_tracking_mode": "total", "check_updates": "true", "check_printer_firmware": "true", "include_beta_updates": "false", "notification_language": "en", "bed_cooled_threshold": "35.0", "ams_humidity_good": "40", "ams_humidity_fair": "60", "ams_temp_good": "28.0", "ams_temp_fair": "35.0", "ams_history_retention_days": "30", "per_printer_mapping_expanded": "false", "date_format": "us", "time_format": "system", "default_printer_id": "None", "ftp_retry_enabled": "true", "ftp_retry_count": "3", "ftp_retry_delay": "2", "ftp_timeout": "30", "mqtt_enabled": "false", "mqtt_broker": "", "mqtt_port": "1883", "mqtt_topic_prefix": "bambuddy", "mqtt_use_tls": "false", "ha_enabled": "false", "library_archive_mode": "ask", "library_disk_warning_gb": "5.0", "camera_view_mode": "embedded", "preferred_slicer": "bambu_studio", "prometheus_enabled": "false", "dark_accent": "orange", "light_accent": "orange", "advanced_auth_enabled": "true", "smtp_host": "smtphub.corning.com", "smtp_port": "25", "smtp_from_name": "3D Print Farm", "smtp_security": "none", "smtp_auth_enabled": "false", "smtp_use_tls": "true", "spoolman_enabled": "false", "spoolman_sync_mode": "auto", "spoolman_disable_weight_sync": "false", "spoolman_report_partial_usage": "true" }, "virtual_printers": [], "integrations": { "notification_providers": [], "spoolman": { "enabled": false, "reachable": false }, "mqtt_relay": { "enabled": false, "connected": false, "broker": "", "port": 0, "topic_prefix": "bambuddy" }, "homeassistant": { "enabled": false } }, "database_health": { "journal_mode": "wal", "quick_check": "ok", "db_size_bytes": 3235840, "wal_size_bytes": 4284832 }, "dependencies": { "fastapi": "0.135.1", "uvicorn": "0.41.0", "pydantic": "2.12.5", "sqlalchemy": "2.0.48", "paho-mqtt": "2.1.0", "psutil": "7.2.2", "httpx": "0.28.1", "aiofiles": "25.1.0", "cryptography": "46.0.5", "opencv-python-headless": "4.13.0.92", "numpy": "2.4.3" }, "log_file": { "size_bytes": 2906311, "size_formatted": "2.8 MB" }, "network": { "interface_count": 0, "interfaces": [] }, "websockets": { "active_connections": 4 } } ``` </details> **Logs (sanitized):** [bambuddy.log](https://raw.githubusercontent.com/maziggy/bambuddy/bug-report-assets/logs/400253bacda241f491526b3225f98742.log) --- *Submitted via BamBuddy Bug Report*
BreizhHardware 2026-05-06 12:29:36 +02:00
Author
Owner

@cadtoolbox commented on GitHub (Mar 12, 2026):

Image
<!-- gh-comment-id:4046676545 --> @cadtoolbox commented on GitHub (Mar 12, 2026): <img width="2041" height="558" alt="Image" src="https://github.com/user-attachments/assets/0a1a693d-42db-4589-b8ce-f5ef2b28e907" />
Author
Owner

@maziggy commented on GitHub (Mar 12, 2026):

Cannot reproduce the problem.

I investigated the code and there's no permission-based filtering of AMS fill level data — all user groups receive the same remain values from the printer via both REST and WebSocket.

Since I wasn't able to reproduce this on my end, so I suspect this might be a browser cache issue. Could you try the following:

  1. Hard refresh the page (Ctrl+Shift+R / Cmd+Shift+R) while logged in as the affected user
  2. If that doesn't help, try clearing browser cache or opening an incognito/private window

If the issue persists after that, I'll need some more details to track it down:

  • Which group are the affected users in? A default group (Operators, Administrators) or a custom group?
  • What permissions does that group have? (Settings → Authentication → Groups → click the group)
  • Are the 0% slots RFID-tagged Bambu Lab spools or generic/untagged spools?
  • Do you have any inventory spool assignments configured? (Settings → Inventory)
  • Can you open browser DevTools (F12) → Network tab → reload the page while logged in as the affected user, and check if any API requests show red/failed (especially
    /api/v1/printers/*/status)?
  • A screenshot of the DevTools Console tab (F12 → Console) while the issue is visible would also help
<!-- gh-comment-id:4047993071 --> @maziggy commented on GitHub (Mar 12, 2026): Cannot reproduce the problem. I investigated the code and there's no permission-based filtering of AMS fill level data — all user groups receive the same remain values from the printer via both REST and WebSocket. Since I wasn't able to reproduce this on my end, so I suspect this might be a browser cache issue. Could you try the following: 1. Hard refresh the page (Ctrl+Shift+R / Cmd+Shift+R) while logged in as the affected user 2. If that doesn't help, try clearing browser cache or opening an incognito/private window If the issue persists after that, I'll need some more details to track it down: - Which group are the affected users in? A default group (Operators, Administrators) or a custom group? - What permissions does that group have? (Settings → Authentication → Groups → click the group) - Are the 0% slots RFID-tagged Bambu Lab spools or generic/untagged spools? - Do you have any inventory spool assignments configured? (Settings → Inventory) - Can you open browser DevTools (F12) → Network tab → reload the page while logged in as the affected user, and check if any API requests show red/failed (especially /api/v1/printers/*/status)? - A screenshot of the DevTools Console tab (F12 → Console) while the issue is visible would also help
Author
Owner

@cadtoolbox commented on GitHub (Mar 12, 2026):

Hard refresh didn't fix the issue or browser cache. Multiple computers show same issue. Only "Viewers" are correct. What's interesting is the Bambuddy instance I use on my laptop for testing new versions works fine. The version installed on the Windows PC is the issue, but only for some accounts. Maybe a communication issue? But I also loaded it from the browser of the machine it's running from and had the same issue.

Here's a few clues. From the Bambuddy logs:
[2398AA591200559] H2D tray_now: multiple AMS [1, 129, 130, 2] on extruder 0, no snow field, using slot 2 (may be incorrect)

From Browser debug:
/api/v1/printers/5/cover?v=%2Fdata%2FMetadata%2Fplate_1.gcode:1 GET http://wl3dprintfarm/api/v1/printers/5/cover?v=%2Fdata%2FMetadata%2Fplate_1.gcode 404 (Not Found)

index-uY-HUfhG.js:7619 WARNING: Multiple instances of Three.js being imported.
(anonymous) @ index-uY-HUfhG.js:7619
/api/v1/settings/:1 Failed to load resource: the server responded with a status of 401 (Unauthorized)
index-uY-HUfhG.js:8715 [WebSocket] Connected
cover:1 Failed to load resource: the server responded with a status of 404 (Not Found)

<!-- gh-comment-id:4048146485 --> @cadtoolbox commented on GitHub (Mar 12, 2026): Hard refresh didn't fix the issue or browser cache. Multiple computers show same issue. Only "Viewers" are correct. What's interesting is the Bambuddy instance I use on my laptop for testing new versions works fine. The version installed on the Windows PC is the issue, but only for some accounts. Maybe a communication issue? But I also loaded it from the browser of the machine it's running from and had the same issue. Here's a few clues. From the Bambuddy logs: [2398AA591200559] H2D tray_now: multiple AMS [1, 129, 130, 2] on extruder 0, no snow field, using slot 2 (may be incorrect) From Browser debug: /api/v1/printers/5/cover?v=%2Fdata%2FMetadata%2Fplate_1.gcode:1 GET http://wl3dprintfarm/api/v1/printers/5/cover?v=%2Fdata%2FMetadata%2Fplate_1.gcode 404 (Not Found) index-uY-HUfhG.js:7619 WARNING: Multiple instances of Three.js being imported. (anonymous) @ index-uY-HUfhG.js:7619 /api/v1/settings/:1 Failed to load resource: the server responded with a status of 401 (Unauthorized) index-uY-HUfhG.js:8715 [WebSocket] Connected cover:1 Failed to load resource: the server responded with a status of 404 (Not Found)
Author
Owner

@maziggy commented on GitHub (Mar 13, 2026):

Not sure if this is the main problem, but I've found an issue...

Inventory fill level overriding AMS remain via nullish coalescing

The fill level display uses a fallback chain: Inventory → AMS remain. The inventory spool assignments query is gated by the inventory:view_assignments permission. The Viewer group likely doesn't have this permission, so the query is skipped entirely and the correct AMS remain values from the printer are shown directly.

For other groups (that do have the permission), the query fires and returns spool assignments. If any of those spools have stale weight_used values (where weight_used >= label_weight), the inventory fill calculates to 0%. The problem is the nullish coalescing operator (??):

const effectiveFill = inventoryFill ?? tray.remain;
// 0 ?? 85 → 0 (not 85, because 0 is not null/undefined)

So a stale inventory fill of 0% permanently shadows the correct real-time AMS remain value from the printer. This also explains why HT units showed correctly — they likely didn't have matching spool assignments.

Fix: When inventory says 0% but the AMS hardware reports a positive remain, the inventory value is now bypassed in favor of the live AMS data. When both agree on 0%, behavior is unchanged.

To verify on your end before the fix ships: check Settings → Inventory for spool assignments on the affected AMS slots — look for spools where the remaining weight is at or near zero while the physical spool still has filament.

Please try with branch dev.

<!-- gh-comment-id:4054130235 --> @maziggy commented on GitHub (Mar 13, 2026): Not sure if this is the main problem, but I've found an issue... **Inventory fill level overriding AMS remain via nullish coalescing** The fill level display uses a fallback chain: Inventory → AMS remain. The inventory spool assignments query is gated by the inventory:view_assignments permission. The Viewer group likely doesn't have this permission, so the query is skipped entirely and the correct AMS remain values from the printer are shown directly. For other groups (that do have the permission), the query fires and returns spool assignments. If any of those spools have stale weight_used values (where weight_used >= label_weight), the inventory fill calculates to 0%. The problem is the nullish coalescing operator (??): const effectiveFill = inventoryFill ?? tray.remain; // 0 ?? 85 → 0 (not 85, because 0 is not null/undefined) So a stale inventory fill of 0% permanently shadows the correct real-time AMS remain value from the printer. This also explains why HT units showed correctly — they likely didn't have matching spool assignments. Fix: When inventory says 0% but the AMS hardware reports a positive remain, the inventory value is now bypassed in favor of the live AMS data. When both agree on 0%, behavior is unchanged. To verify on your end before the fix ships: check Settings → Inventory for spool assignments on the affected AMS slots — look for spools where the remaining weight is at or near zero while the physical spool still has filament. Please try with branch dev.
Author
Owner

@cadtoolbox commented on GitHub (Mar 13, 2026):

@maziggy That was what I saw. The inventory spool was set to 0 remaining weight even with full spools in the AMS. Working on re-testing soon.

<!-- gh-comment-id:4056224467 --> @cadtoolbox commented on GitHub (Mar 13, 2026): @maziggy That was what I saw. The inventory spool was set to 0 remaining weight even with full spools in the AMS. Working on re-testing soon.
Author
Owner

@maziggy commented on GitHub (Mar 23, 2026):

Any news here?

<!-- gh-comment-id:4109560577 --> @maziggy commented on GitHub (Mar 23, 2026): Any news here?
Author
Owner

@cadtoolbox commented on GitHub (Mar 23, 2026):

@maziggy All looks good in the last updates. Thanks again!

<!-- gh-comment-id:4111268617 --> @cadtoolbox commented on GitHub (Mar 23, 2026): @maziggy All looks good in the last updates. Thanks again!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/bambuddy#447
No description provided.