Docs / Troubleshooting Playbook

Troubleshooting Playbook

This playbook covers common symptoms, root causes, and verified fixes when integrating, tuning, or deploying LocalNPC.


Quick Reference Diagnostic Matrix

SymptomPrimary CauseImmediate Solution
Error NativeLibraryMissing naming llamalib_win-x64_avx2.dll or llamalib_win-x64_noavx.dllMissing DLL, missing Visual C++ Redistributable, or 32-bit buildEnsure StandaloneWindows64, verify both DLLs are in <Game>_Data/Plugins/x86_64/, and install the Visual C++ 2015–2022 x64 Redistributable
Error text starts with "Windows blocked this file" (Windows error 4551)Windows Application Control (Smart App Control) or antivirus software blocked a native libraryMove the game out of Downloads or a synced folder, then add an antivirus exclusion for the game folder. Never turn off Smart App Control. See section 1
Warning "This CPU does not report AVX2" and very slow repliesThe CPU has no AVX2, so the slower noavx library was loadedExpected on such a CPU. See section 1
Crash inside llamalib_win-x64_avx2.dll on an older CPUThe CPU reports AVX2 but lacks FMA, F16C or BMI2 (not observed)Set the environment variable LOCALNPC_FORCE_NOAVX=1. See section 1
An error message contains "Speech input is off. Text input still works."The speech model or a speech-to-text library could not be loadedTyped input keeps working. Read the message: it names the file and the fix. See "Speech Input Is Off" in section 1
Warning "Loaded 'ggml-cpu-x64.dll' instead; speech recognition will be slow."The CPU has no AVX2, or ggml-cpu-haswell.dll is missing or blockedExpected on a CPU without AVX2. See section 1
The NPC answers in text only; the Console shows "No Windows voice for language ..."Windows has no voice for the NPC's languageAdd a voice in Settings > Time & language > Speech. See "The NPC Answers in Text Only" in section 1
A replaced or updated DLL has no effect, or a load fails right after an updateThe old speech-to-text libraries are still loaded in the Unity processClose Unity and open it again. See "Restart Unity After Replacing the DLLs" in section 1
A second NPC starts its reply lateReplies take turns: one is generated at a timeKeep replies short (low max-tokens setting). See section 5
NPC contradicts itself or gets a fact wrongLimit of a small model (1.5B by default, 0.5B with Fast)See section 4
Editor crashes on exiting Play ModeLeaked native handleEnsure domain reload hooks and Dispose() run cleanly
NPC answers questions nobody askedWhisper hallucinating on silenceNo setting; see "NPC Answers Questions Nobody Asked" below
First word of every utterance missingMissing audio pre-rollThe agent's microphone uses a fixed 500 ms pre-roll; with your own VoiceActivityGate, raise PreRollMs
"It cuts me off mid-sentence"Silence hysteresis too shortThe agent's microphone waits a fixed 900 ms of silence; with your own VoiceActivityGate, raise MinSilenceMs
"It takes forever to respond"Prefix cache miss or slow presetInspect DiagnosticsWindow; check if system prompt is byte-stable
Latency doubled after prompt editDynamic text in system promptRemove timestamps/variables from system prompt to restore KV cache hits
NPC speaks <|im_end|> or *smiles*Missing stop strings, or the model writes actionsAdd stop strings; tell the NPC in its personality not to write actions. See section 4
Garbled non-ASCII charactersBroken UTF-8 byte boundaryEnsure LlamaTokenStream UTF-8 multi-byte buffer is enabled
Audible stutter between sentencesFrame polling audio playbackEnable dspTime scheduled audio stitching in SpeechAudioQueue
Frame rate hitches every few secondsManaged garbage collection (GC)Reuse preallocated buffers and verify zero GC in profiler
Second NPC causes Out-of-MemoryDuplicate model instances in RAMUse NpcServiceLocator so all agents share one model instance
Works in Editor, fails in IL2CPPManaged code strippingSet Managed Stripping Level to Minimal and include link.xml
Poor transcription accuracyAudio sample rate aliasingUse 48 kHz or 16 kHz default mic; verify resampler sinc filter
NPC talks to itself in an echo loopMic picking up speaker audioUse headphones or a headset, or a directional microphone; lower the speaker volume
Error MicrophoneUnavailableNo microphone, microphone could not be started, or it is silentRead the error message; see "Error MicrophoneUnavailable" below
NPC never reacts to my voice, no errorListening was not started, or another NPC owns the microphoneSee "The NPC Does Not Hear Me" below
Model download fails silentlyInsufficient disk spaceCheck disk space; delete stale .part download files

1. Native & Platform Issues

Error NativeLibraryMissing (a llamalib_win-x64_*.dll could not be loaded)

"Windows blocked this file" (Windows error 4551)

Speech Input Is Off (Text Input Still Works)

Speech-to-text runs inside the game's own process, through the five whisper.cpp 1.9.5 DLLs in Plugins/x86_64. No .exe is started. The speech model is the speech-to-text entry of the model catalogue.

When the model or a library cannot be loaded, NpcAgent raises OnError once with the real error code. The message says what is wrong and what to do, and contains the sentence "Speech input is off. Text input still works." The agent goes to Idle, typed input (SayAsync) works, and StartListening() reports an error and does not start the microphone.

LocalNPC does not try again by itself after you fix the cause. Leave Play Mode and enter it again (in a game: restart it).

The NPC Answers in Text Only (No Windows Voice)

The NPC speaks with a Windows system voice: a OneCore voice, with SAPI 5 as the last fallback. LocalNPC downloads no voice. For en-US it tries Microsoft Mark, then Microsoft Zira, then Microsoft David, then any other en-US voice, then a voice of another English region (en-GB, en-AU, ...), then a SAPI 5 en-US voice. When it finds none, every reply is still shown (OnSentenceSpoken fires for each sentence), nothing is heard, and the Console shows one warning:

No Windows voice for language 'en-US' is installed (none of [Microsoft Mark, Microsoft Zira, Microsoft David], no other voice of that language or of 'en', no SAPI 5 voice). Add one in Windows Settings > Time & language > Speech > Manage voices > Add voices. The NPC voice is off; replies are shown as text.

Restart Unity After Replacing the DLLs

Once loaded, the speech-to-text libraries and the voice library stay loaded for the life of the process. Leaving Play Mode, a script reload and Unload() free the speech model, but not the libraries. So after a package update, or after you replace a file in Plugins/x86_64 by hand, close Unity and open it again; until then the process still uses the old files.

CPU Without AVX2, and LOCALNPC_FORCE_NOAVX=1

Editor Crashes on Exiting Play Mode

Works in Editor, Fails in Standalone IL2CPP

The Sample Scene Is Pink

DirectoryNotFoundException in Library\PackageCache


2. Audio & Voice Activity Detection (VAD)

Error MicrophoneUnavailable

NpcAgent raises this through OnError when it is listening and the microphone cannot be used. It is raised once per failure, not every frame. The agent stays in the Listening state. A missing microphone and a failed start are tried again every 2 seconds. If the NPC still does not hear you after the cause is removed, call StopListening() and then StartListening(). The message tells the three cases apart:

LocalNPC cannot tell these three causes apart from silence alone, so it never raises MicrophonePermissionDenied on Windows.

The NPC Does Not Hear Me

If there is no error and the NPC never reacts to speech:

First Word of Every Utterance Missing

"The NPC Cuts Me Off Mid-Sentence"

NPC Answers Questions Nobody Asked (Hallucinations)

NPC Talks to Itself in an Echo Loop


3. Latency & Performance

"It Takes Forever to Respond" (> 2.5 seconds)

Open Tools > LocalNPC > Diagnostics Window during Play Mode to view the exact per-stage latency breakdown:

Latency Doubled After Changing the System Prompt

Frame Rate Hitches Every Few Seconds

Audible Gaps Between Sentences During Speech

A pause of 300 ms after a sentence that ends with ., ! or ? is intended: the Windows voice adds it so that sentences do not run together. A long sentence that is cut before its end gets no such pause.


4. LLM Generation Quality & Formatting

NPC Speaks <|im_end|> or *smiles warmly* Out Loud

Garbled Non-ASCII or Unicode Characters in Replies

NPC Contradicts Itself or Gets a Fact Wrong (Limits of a Small Model)


5. Multi-Agent & Memory

Second NPC Causes Out-of-Memory (OOM)

A Second NPC Waits Before It Replies

Only One NPC Can Listen at a Time

Only one NpcAgent can listen to the microphone at a time. Call StopListening on one before StartListening on another.

Unload() Returns but the Model Stays Loaded


6. Known Issues in v1.0

Known limits of this version, and what to do about each one.


Still Need Help?

If you encounter an issue not covered in this playbook:

  1. Export a diagnostics report: after a Play session with the NPC, open Tools > LocalNPC > Diagnostics Window and click the Export CSV button.
  2. Check the generated LocalNPC_BuildManifest.json for checksum mismatches.
  3. Email us, as described below.

Getting help

Email localnpcsupport@gmail.com. Please include:

We are a small team, so a reply can take a few days.

This page is the file docs/11-troubleshooting.md of the LocalNPC package documentation (also in the package as Documentation~/11-troubleshooting.md).