## TL;DR

Wait for ingestion and double-check the index name when searches come back empty.

## Steps

1. Regenerate the token on 401 and verify the role's search capability on 403 before touching your code. Wait for ingestion and double-check the index name when searches come back empty. Confirm network access to the management port and that the URL includes the protocol and port when the connection itself fails.

## When to use

You are seeing this: Regenerate the token on 401 and verify the role's search capability on 403 before touching your code. Use this skill when you run into "Splunk 401 means regenerate the token, 403 means it lacks search rights".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
