Troubleshoot a watcher
Fix watcher problems by symptom: will not start, files not detected, uploads stuck, auto-update quiet, and where to find logs.
Find your symptom below. If none fits, start with the logs. The instrument’s watcher page also shows the watcher’s events, heartbeats, and settings: select the status badge beside the instrument’s name, or choose Watcher from its three-dot menu. Anyone signed in can read it.
An instrument shows Offline
An instrument’s badge reads Offline when new files can’t reach Data Hub right now. A notice under the instrument’s name says why, and See details opens the watcher’s Activity tab. Find the notice below.
| Notice | What it means | What to do |
|---|---|---|
| New files aren’t being picked up | The watcher is running but can’t find its watch folder. | Create or reconnect the folder on the PC, or let an admin choose Change folder. See The watcher shows “Waiting: folder not found”. |
| The watcher isn’t checking in | No heartbeat for 5 minutes, or the watcher didn’t come back within 15 minutes of a restart or an update. The PC may be off, the watcher may have crashed, or the network may be blocking Data Hub. | On the PC, check that the watcher is running (data-hub-watcher service status on Windows) and that it can reach Data Hub; see “Connection error” or “Request timed out”. Its last events are on the Activity tab. |
| The watcher never checked in | The watcher registered but sent no heartbeat within 15 minutes of registering, or of an admin confirming the instrument if that came later. The service may never have started, or the PC can’t reach Data Hub. | Start the watcher on the PC, as in step 5 of Set up an instrument. If it won’t start, see The watcher will not start. If it is running, check that it can reach Data Hub; see “Connection error” or “Request timed out”. |
| Uploads from this instrument are paused | Someone stopped the watcher, for example with data-hub-watcher service stop or Ctrl+C. | Start it again: data-hub-watcher service start on Windows, or data-hub-watcher watch. |
| This instrument isn’t connected to a watcher | The instrument never had a watcher, or its watcher was deregistered, which the notice dates and credits. | Run data-hub-watcher init on the PC; see The watcher stopped and says it was deregistered. Admins can follow Connect a watcher. |
Restarting and Connecting aren’t problems: each turns Offline if it lasts more than 15 minutes. See The instrument shows Restarting after a restart. Files saved on the PC while an instrument is offline stay there, and the watcher picks them up once it runs again.
People who subscribe to the instrument hear about it once the badge has read Offline for 30 minutes, in the app and in Slack if they turned that on, with the notice’s reason. They hear again when it’s back Online. See When an instrument goes offline.
datahub.example.com/instruments/colony-counter-g

Setup and registration
“Instrument is still pending activation”
The instrument was registered but an admin hasn’t confirmed it. Its badge reads Pending. Ask an admin to open Instruments, choose Confirm…, pick an instrument type, and choose Confirm instrument. See Manage instruments.
“Instrument already has an active watcher”
Each instrument can have at most one active watcher, and an earlier install is still registered, for example on another PC or from before the PC was reimaged. The command prints the existing watcher’s ID. Deregister that watcher, then run init again:
- Web app: open the instrument, select its status badge to open its watcher page, and choose Deregister from the ⋮ menu. You can also use the row menu in Settings → Watchers. Only admins see those menus. Watcher 1.4.3’s message names a menu that no longer exists; watcher 1.4.4 prints the address of the watcher’s page instead
- API:
DELETE /api/v1/watchers/your_existing_watcher_idwith a token that haswatchers:admin
Deregistration is a soft delete: the history stays with the instrument as a past watcher, and on the Deregistered tab of Settings → Watchers.
init rejects my API key
The wizard refuses keys that don’t start with dhub_. It also removes invisible characters that the Windows clipboard can add, such as zero-width and non-breaking spaces. If a paste keeps failing, run data-hub-watcher init --show-key to see what the prompt received.
The watcher won’t start
- Run
data-hub-watcher config showto check the config and environment - Run
data-hub-watcher watch --dry-run, which prints the first check that fails - Check that an admin has confirmed the instrument; a Pending instrument can’t upload
- On Windows, if the service won’t start, see Windows service problems
The watcher stopped and says it was deregistered
Someone deleted the watcher’s registration on Data Hub. This happens when an admin deregisters the watcher in the web app, or retires its instrument (see Deregister a watcher). After a deregistration, the instrument reads Offline and its notice says its watcher was deregistered. A retired instrument reads Retired, with no notice. Watcher 1.4.3 and later stop by themselves when this happens. The watcher logs one error:
This watcher was deregistered on Data Hub, so its registration no longer exists. Run 'data-hub-watcher init' to register it again.
You can find that error in watcher.log (see Where are the logs?). On Windows, it is also in the Application event log, and service status shows the service as stopped.
The watcher waits for three heartbeats in a row that Data Hub answers with its “deregistered” reply. At the usual one-minute interval, that is about three minutes, so one wrong answer can’t stop the watcher. A different error, including Data Hub saying it has no watcher with that ID, doesn’t stop it. Once it has stopped, it uploads nothing and doesn’t come back on its own. Starting it again is refused with the same message. watch exits with code 3 when it stops this way, and when it refuses to start.
To use the PC again:
If the instrument was retired, ask an admin to reactivate it first. init is refused for a retired instrument.
Run data-hub-watcher init on the PC to register a new watcher for the instrument. The PC keeps its upload history, so files that were already uploaded aren’t uploaded again. If init reports that the instrument already has an active watcher, see Instrument already has an active watcher.
On Windows, run data-hub-watcher service start from an Administrator terminal.
Watchers older than 1.4.3 don’t stop. They keep running and get errors from Data Hub until someone stops them.
The watcher shows “Waiting: folder not found”
The watcher starts even when the watch folder is missing, for example when a network drive isn’t connected yet or the folder was renamed. The watcher keeps sending heartbeats but watches nothing. Its page shows Waiting: folder not found, and the instrument reads Offline with the notice “New files aren’t being picked up”. Hover over the watcher’s badge to see which folder it’s looking for; the notice names it too.
The watcher checks for the folder again once a minute and starts watching as soon as it appears. To fix it:
- Create or reconnect the folder on the PC, or
- Point the watcher at the right folder from the web app: an admin chooses Change folder in the notice, which opens the watcher’s Settings tab with the Watch folder field selected; see Change a watcher’s settings
The watcher also goes back to this state when the folder disappears while it runs, for example when a network drive drops or the folder is deleted (watcher 1.4.3 and later). It notices within a minute, looks again a few seconds later so that a drop of a moment doesn’t count, stops watching, and shows Waiting: folder not found. It gives a file that was uploading at that moment up to 10 seconds to finish, cuts it off if it isn’t done, and uploads it again once the folder is back. When the folder returns, the watcher starts watching it again without a restart, and queues a watcher_started event that says it resumed.
A config change shows “Change rejected”
The watcher checked a change made in the web app and refused it, so it kept its previous settings. The reason shows in a Change rejected notice on the watcher’s Settings tab and as an error event with details.kind set to config_revision_rejected. For example, the folder doesn’t exist on the PC or the watcher can’t read it. Fix the cause, then save the change again or Restore an earlier version from the history.
“Data Hub can’t read the watcher’s config file”
The watcher’s Settings tab shows this when the config.yaml the watcher sent breaks the rules the web app checks, for example a relative watch folder, more than 50 file patterns, or a run detection pattern with Python-only syntax such as (?P<name>…). The notice names each field that needs fixing, by its key in the file.
Until it’s fixed, edits made on the PC aren’t recorded in the history, and if Data Hub has no earlier copy of the settings, there’s nothing to edit in the web app. Fix the file on the instrument PC, for example with data-hub-watcher config edit.
A config change stays on “Change pending”
The watcher picks up a change after its next heartbeat, within about a minute. If the change stays pending, check that the watcher is Online on its page. An offline watcher applies the change when it next starts.
The instrument shows Restarting after a restart
When the PC restarts, or the watcher stops to install an automatic update, the instrument’s badge reads Restarting for up to 15 minutes, not Offline. Nothing is wrong. The watcher checks in once a minute, so it can take up to a minute after the service starts to show as Online. Refresh the page after a minute. A new watcher reads Connecting until its first check-in, and Offline, with the notice “The watcher never checked in”, if none arrives within 15 minutes.
If the badge turns Offline with the notice “The watcher isn’t checking in”, the watcher didn’t come back. Check that the process is running and see “Connection error” or “Request timed out”. Older watchers don’t say they are restarting, so they read Offline from the moment the PC goes down; see When the PC restarts or shuts down.
Heartbeats fail with 426 Upgrade Required
The watcher is older than the Minimum supported version an admin set under Settings → Watchers, so Data Hub refuses its heartbeats and it shows as Unresponsive. Its instrument reads Offline. It keeps checking for updates every hour and upgrades itself if Latest version is newer. To upgrade now, run data-hub-watcher self-update. See Roll out watcher releases.
“Connection error” or “Request timed out”
The watcher can’t reach the Data Hub API. Check these:
- The instrument PC is connected to the network
- The config has the right environment (
staging,production, orpreview); rundata-hub-watcher config show - The PC can reach the API URL for that environment, for example by opening it in a browser on the PC
A run is missing after a connection problem
The watcher retries a run report that failed because it couldn’t reach Data Hub, or because Data Hub returned a server error. The first retry comes after 5 seconds. The wait then doubles up to 5 minutes between tries, and the watcher keeps trying every 5 minutes until the report goes through. It needs no new file and no restart, so the run appears on its own once the problem clears.
The watcher records one run_report_failed event when a run’s report first fails. It doesn’t record another for the same run while it keeps retrying, even if more files in the run finish in the meantime.
A failure that isn’t a connection problem or a server error, such as 401 Unauthorized, is not retried, because it would fail the same way. Each one is recorded, except the refusals of a run that was deleted on Data Hub, which watcher 1.4.3 and later record once per run (see A run was deleted on Data Hub). Fix the cause, then restart the watcher.
A run was deleted on Data Hub
A run report or an upload request that fails with 409 Conflict and a message that starts “This run was deleted on Data Hub” means someone deleted the run. Data Hub refuses a watcher’s report of a deleted run, and its requests to upload the run’s files, and the files in a refused report aren’t added to the run.
Watcher 1.4.3 and later record one event for the run, a run_report_failed event or an upload_failed event, whichever the watcher meets first, and stop reporting the run and uploading its files until the watcher restarts. A restart tries once more, and records one more event if the run is still deleted. After you restore the run, restart the watcher to send its files. A file that someone requests with Upload on the run page doesn’t wait for the restart: the watcher asks Data Hub for each requested file, and once Data Hub accepts one, the watcher reports and uploads the run’s new files again.
Earlier watchers record one event for each file, and do it again each time they start. After you restore the run, they send its files when another file of the run finishes or the watcher restarts.
To stop the errors without restoring the run, move the run’s files out of the watch folder.
Files aren’t being detected
- Check the watch folder and file patterns. The instrument’s page in the web app shows both, or run
data-hub-watcher config showon the PC. Admins can change them from the web app; see Change a watcher’s settings - Check that the instrument saves its files into that folder, not a shared network drive or another folder
- Check the file patterns. They’re case-sensitive, so
*.csvdoesn’t matchdata.CSV - If files are in subfolders, turn on subfolders in run detection (
recursive: true); see Configure run detection and uploads - Run
data-hub-watcher watch --dry-runto preview matches - Look for
pattern_mismatchevents on the watcher’s Activity tab
Files are detected but not uploading
- In manual mode, files wait for approval in the upload queue; see Manage the watcher fleet
- On the run page, the Upload buttons are turned off while the instrument is Connecting, Offline, Pending, or Retired, with the reason beside them. Fix the watcher first; see An instrument shows Offline. While the instrument is Restarting they stay on, and the request waits for the watcher
- Files read Not uploaded until someone requests them, or Waiting to upload while an auto-mode watcher (1.4.5 and later) is about to send them
- A file that reads Upload failed is one the watcher gave up on. Hover over its status for the reason; see A file reads Upload failed
- Check the log for
upload_failed - A
state_write_failedevent in the watcher’s event log means the PC’s disk is full or the watcher’s state file can’t be written. Free up space; the watcher retries on its own and uploads the files once it can write again - A revoked or expired token shows up as
401 Unauthorized. Create a new token and re-runinit; see Issue and revoke tokens
A file reads Upload failed
The watcher marks a file Upload failed when it gives up on it, and its activity shows one Couldn’t upload entry per run and reason. Hover over the file’s status for the reason:
- The folder is no longer on the instrument PC. The run folder was renamed or moved after the watcher found it. The watcher reports the folder under its new name as a new run, so check for a run with the same start time and a similar name. If its files are already uploaded, delete the old ones.
- The file isn’t on the instrument PC. The file was moved or deleted. Put it back and choose Upload, or choose Delete.
- The upload kept failing. For example, because of a network or storage problem. The message shows the last error. Choose Upload to try again once it’s fixed.
- The path is outside the watch folder. Check the watcher’s Watch folder setting.
Watchers before 1.4.5 put the file back to Not uploaded without a reason, and log a “Queued file missing” and a “Gave up uploading” error for each file instead. See When an upload fails.
An upload was cut off by a restart or an update
The watcher retries an automatic upload that didn’t finish, such as one cut off by a restart or an update, the next time it starts, on up to three starts. Until it succeeds, the file reads Upload failed with the reason. Choose Upload on the run page to try again sooner.
Watchers before 1.4.5 don’t mark the file. Instead they record upload_retries_exhausted when the upload still failed after three starts, or pending_upload_missing when the file was no longer on disk at start.
A file stays on Not uploaded after the watcher restarted
Watchers before 1.4.1 could lose track of a file in an automatic upload when the watcher stopped without shutting down cleanly, such as after a reboot, a power cut, or a crash, right after it reported the run. The run is in Data Hub, but the file reads Not uploaded and nothing uploads it, because after the restart the watcher treats the file as already handled. Watcher 1.4.1 and later record a run and its files on the PC together, so a restart like that doesn’t leave a file behind.
Updating doesn’t pick up files that an older watcher already lost this way. Ask for them from the run page:
Open the run, select the files that read Not uploaded, and choose Upload. To ask for the files of several runs at once, select the runs in the run list and choose Upload. See Request an upload.
The watcher picks up the request within a minute and uploads the files that are still on the instrument PC.
Automatic updates never happen
Check these, in order:
- The watcher runs as a Windows service, or on a schedule. A watcher started by hand in a terminal may not run long enough to reach its hourly update check
- The environment isn’t
preview, where automatic updates are always off - The watcher isn’t waiting until it’s idle. Run
data-hub-watcher self-updateto update now, or ask an admin to turn on Mandatory update - Last heartbeat on the watcher’s page is recent. A watcher that has stopped checking in also stops checking for updates
Install and update the watcher and Roll out watcher releases cover failed updates, such as update_started followed by update_failed, development installs, and a missing Scheduled Task.
Windows service problems
The service exits immediately
A config file that doesn’t load stops the service: one that’s missing, can’t be read, isn’t saved as UTF-8, has broken YAML, or has a value the watcher doesn’t accept. watcher.log has an error that starts with Cannot load config, followed by the reason. The error also gives the command that checks the file, in the form data-hub-watcher --config "C:\path\to\config.yaml" config validate. Run it as written, because without --config it checks the config file of the person who runs it, not the one the service uses. Fix what it reports and start the service again.
An env file that isn’t saved as UTF-8 stops the service the same way, with an error that starts with Cannot load env file. Windows PowerShell 5.1 writes UTF-16 for > and >>, so echo X=Y >> .env.production breaks a UTF-8 env file. Watchers before 1.4.2 wrote only a traceback to the Application event log for either problem.
If it stops before writing to watcher.log:
- Check
C:\ProgramData\DataHubWatcher\service-bootstrap.logfor a crash before the service fully started, such as a missingpywin32, a moved Python environment, or a broken install - Query the Windows Application event log:
Get-WinEvent -FilterHashtable @{LogName='Application'; StartTime=(Get-Date).AddHours(-1)} |
Where-Object { $_.ProviderName -match 'Python|DataHubWatcher' -or $_.Message -match 'DataHubWatcher' } |
Format-List TimeCreated, ProviderName, Id, LevelDisplayName, Message- Run the service in a terminal to see the full error:
& "C:\path\to\venv\Scripts\python.exe" -m win32serviceutil debug DataHubWatcherself-update says “Upgrade dispatched” but nothing happens
On Windows, when the watcher was installed with uv tool install, the upgrade runs separately as the SYSTEM account and takes 30 to 60 seconds. To follow it:
Get-Service data-hub-watcher
Get-Content ~/.data-hub/upgrade-worker.log -Tail 20 -WaitTurn on debug logging for the service
Add DATA_HUB_WATCHER_LOG_LEVEL=DEBUG to the env file the service loads, such as ~/.data-hub/.env.production, and restart the service. No reinstall needed. This works with watcher 1.4.2 and later; earlier versions ignore the setting in the env file.
Where are the logs?
The watcher keeps the current log and up to five older ones, 10 MB each. watch in a terminal and the Windows service write to the same file:
| Platform | Log file |
|---|---|
| Windows | C:\ProgramData\DataHubWatcher\watcher.log |
| macOS / Linux | ~/.data-hub/watcher.log |
To print debug messages in the terminal, add --verbose: data-hub-watcher --verbose watch. On Windows, the output of an update goes to ~/.data-hub/upgrade-worker.log.
API clients get 401 Unauthorized
The bearer token is missing, mistyped, revoked, or expired. Check Settings → Access Tokens, and ask an admin for a new token if needed. See Issue and revoke tokens.
A script that calls the watcher or processing routes with a browser session, instead of a token, also gets 401. Those routes accept only personal access tokens; see How a token acts.
MCP clients get 401 Unauthorized
MCP doesn’t accept personal access tokens, so a client configured with Authorization: Bearer dhub_… gets a 401 on every call. Remove the header, leave only the URL, and let the client run its sign-in flow. Setup per client is in MCP overview.
A connected client that starts failing has most likely lost its sign-in, so sign in again from the client. If reads work and one tool fails with a missing-scope message, the client holds read but not write; reconnect and approve both.
Ask an agent to diagnose it
An AI assistant connected over MCP can look into a watcher problem for you with the troubleshoot_instrument prompt; see MCP prompts.