{"record":{"id":"128702d2f887a01a","repo":"MuntashirAkon/AppManager","slug":"adb-command-did-not-produce-successprefix","errorCode":null,"errorMessage":"ADB command did not produce ${successPrefix}","messagePattern":"ADB command did not produce (.+?)","errorType":"exception","errorClass":"java.io.IOException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/servermanager/LocalServerManager.java","lineNumber":327,"sourceCode":"                    }\n                }\n            } catch (Throwable e) {\n                readFailure.set(e);\n            } finally {\n                commandWatcher.countDown();\n            }\n        }, \"am-adb-command-output\");\n        outputThread.start();\n        try {\n            outputStream.write(\"id\\n\".getBytes(StandardCharsets.UTF_8));\n            outputStream.write((command + \"\\n\").getBytes(StandardCharsets.UTF_8));\n            outputStream.flush();\n            if (!commandWatcher.await(timeout, timeoutUnit)) {\n                throw new SocketTimeoutException(\"Timed out waiting for ADB command: \" + command);\n            }\n            if (!commandSucceeded.get()) {\n                Throwable failure = readFailure.get();\n                throw new IOException(\"ADB command did not produce \" + successPrefix, failure);\n            }\n        } finally {\n            outputThread.interrupt();\n        }\n    }\n\n    @WorkerThread\n    private void useRootStartServer() throws Exception {\n        if (!Ops.hasRoot()) {\n            throw new Exception(\"Root access denied\");\n        }\n        String command = ServerConfig.getServerRunnerCommand();\n        // + \"\\n\" + \"supolicy --live 'allow qti_init_shell zygote_exec file execute'\";\n        Log.d(TAG, \"useRootStartServer: %s\", command);\n        Runner.Result result = Runner.runCommand(command);\n\n        Log.d(TAG, \"useRootStartServer: %s\", result.getOutput());\n        if (!result.isSuccessful()) {","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/servermanager/LocalServerManager.java#L309-L345","documentation":"executeAdbCommand sends an ADB shell command and waits for completion; a success marker identified by successPrefix is expected in the output. If the command finished but the marker never appeared, an IOException wrapping the captured read failure is thrown, meaning the ADB command ran but did not produce the expected result.","triggerScenarios":"Calling useAdbStartServer or stopServer when the underlying ADB command exits without the expected success marker in its output stream, e.g. adb server start fails, adbd rejects the command, or remote output ends early.","commonSituations":"ADB not authorized on the device, adbd running on an unexpected port, device storage full preventing the server from starting, or SELinux policies blocking the shell command.","solutions":["Inspect the wrapped failure cause (readFailure) for the real ADB error and fix that underlying issue","Verify ADB is authorized and adbd is running on the device (adb devices, check authorization prompt)","Retry the operation once; transient ADB daemon startup races often succeed on a second attempt","Check device storage and SELinux denials in logcat that may abort the command"],"exampleFix":"// before\nthrow new IOException(\"ADB command did not produce \" + successPrefix, failure);\n// after\nif (failure != null) {\n    throw new IOException(\"ADB command did not produce \" + successPrefix + \": \" + failure.getMessage(), failure);\n} else {\n    throw new IOException(\"ADB command did not produce \" + successPrefix);\n}","handlingStrategy":"try-catch","validationCode":"if (AdbUtils.isAdbdRunning()) { /* safe to run ADB commands */ }","typeGuard":null,"tryCatchPattern":"try {\n    executeAdbCommand(...);\n} catch (SocketTimeoutException e) {\n    // command hung: increase timeout or kill adb server\n} catch (IOException e) {\n    Throwable cause = e.getCause();\n    Log.e(TAG, \"ADB command failed: \" + (cause != null ? cause.getMessage() : \"no success marker\"), e);\n}","preventionTips":["Check adbd availability (AdbUtils.isAdbdRunning) before issuing commands","Set a generous command watcher timeout for slow devices","Log the full command output to diagnose missing success markers","Retry once on transient ADB daemon startup races"],"tags":["adb","android","io"],"backgroundTag":"unexpected-response-shape","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}