crowdsecurity/crowdsec · error

can't update scenario list: %w

Error message

can't update scenario list: %w

What it means

Returned by JWTTransport.refreshJwtToken when the configured UpdateScenario callback fails while refreshing the login token, so the machine's scenario list cannot be attached to the auth request. Wraps the callback's error; the fault is in the scenario-update input, not the HTTP layer.

Source

Thrown at pkg/apiclient/auth_jwt.go:49

	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport        http.RoundTripper
	UpdateScenario   func(context.Context) ([]string, error)
	TokenRefreshChan chan struct{} // will write to this channel when the token is refreshed

	refreshTokenMutex sync.Mutex
	TokenSave         TokenSave
}

func (t *JWTTransport) refreshJwtToken(ctx context.Context) error {
	var err error

	log.Debugf("refreshing jwt token for '%s'", *t.MachineID)

	if t.UpdateScenario != nil {
		t.Scenarios, err = t.UpdateScenario(ctx)
		if err != nil {
			return fmt.Errorf("can't update scenario list: %w", err)
		}

		log.Debugf("scenarios list updated for '%s'", *t.MachineID)
	}

	auth := models.WatcherAuthRequest{
		MachineID: t.MachineID,
		Password:  t.Password,
		Scenarios: t.Scenarios,
	}

	/*
		we don't use the main client, so let's build the body
	*/
	var buf io.ReadWriter = &bytes.Buffer{}
	enc := json.NewEncoder(buf)
	enc.SetEscapeHTML(false)

View on GitHub (pinned to 909b515798)

Solutions

  1. Check the local hub/scenario loading that backs UpdateScenario
  2. Inspect the wrapped error for the root cause
  3. Retry after fixing scenarios; authentication is blocked until it succeeds
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/apiclient/auth_jwt.go:49 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06). Data as JSON: /api/errors/238bebb5bbe5ce09. Report an issue: GitHub.