nightscout / nightscout/AndroidAPS

[Accu-Chek Combo] Loop permanently stuck in "Error State" after W6 or Occlusion, refusing to reconnect/sync (State Machine Logic Flaw)

Open
#4,479 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
1.2k
Forks
6.4k
Avg merge
2d 7h
Merged PRs (30d)
19

Description

Description

I am using AndroidAPS with the Accu-Chek Spirit Combo pump. I have identified a systemic issue where the ComboV2Plugin gets "stuck" in an Error State and refuses to communicate with the pump, even after the pump itself has returned to normal operation.

This affects two distinct scenarios:

  1. Scenario A (W6 Warning): Transient warnings that clear themselves.
  2. Scenario B (Occlusion): Critical errors cleared manually by the user on the pump.

The Core Issue (Root Cause)

The issue appears to be in the driver's connection logic. Once an error is flagged, the driver blocks all future connection attempts with the message:
Cannot connect while driver is in the Error state
This prevents AAPS from ever discovering that the pump is actually back online and running.


Detailed Scenarios

Scenario A: W6 Warning (Transient)
  • Trigger: Pump issues a "W6 TBR CANCELLED" warning (often due to transient Bluetooth instability on Android 15).
  • Behavior: AAPS stops the loop. Even after the W6 warning clears on the pump automatically, AAPS remains in the error state indefinitely.
  • Impact: Loop fails to resume without a force restart of the app.
Scenario B: Occlusion (User Intervention)
  • Trigger: Pump alarms for Occlusion (E4).
  • User Action: The user manually clears the alarm on the physical pump and restarts the pump (Standard procedure). The pump is now delivering insulin.
  • Behavior: If the user forgets to also manually click "Refresh" or clear the error inside AAPS, AAPS remains disconnected.
  • Impact: The pump is running (delivering Basal), but the Loop is stopped. AAPS fails to sync with the pump's actual "Running" status because the "Error State" in the software blocks the connection attempt.

Image

Log Evidence

I captured logs during the failure state (Scenario A), but the logic applies to both. The driver explicitly refuses to connect:

D/PUMP: [ComboV2Plugin.connect():564]: Cannot connect while driver is in the Error state
D/PUMP: [Pump.connect():3611]: [Pump] Got exception while connecting...

Diagnostic / Workaround

In both scenarios, Force Restarting the AAPS app fixes the issue immediately.
1. User kills the app.
2. App restarts -> Initializes fresh driver state -> Connects to pump -> Sees pump is "Running" -> Resumes Loop.

This proves that the pump is reachable and functional. The issue is purely that the running AAPS instance refuses to reset its internal "Error State" to check the pump.

Expected Behavior

The driver should not let a historical Error State block a current connection attempt.

1. Poll Status: AAPS should periodically attempt to connect to the pump even if it was previously in an error state.

2. Sync Reality: If the connection succeeds and the pump reports "I am Running" (no longer in W6 or Occlusion), AAPS should update its internal state to match the pump and resume the loop.

3. Safety: It is safer for AAPS to know the pump is running than to stay disconnected believing the pump is stopped.

Environment

• Phone: OnePlus 15 (Android 16)
• Pump: Accu-Chek Spirit Combo
• AAPS Version: [3.4.0.0]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The reported entry points are ComboV2Plugin.connect() at line 564 and Pump.connect() at line 3611; start by tracing how the Error state blocks reconnects after W6 and occlusion. Reproduce the force-restart recovery path and verify that a reachable, running pump can clear the stale state and resume syncing.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
embedded-iot, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.