langgenius/dify · error · BaseError
NotLoggedIn
NotLoggedIn
Error message
no credential stored for ${target} on ${host} What it means
Thrown by `runUseAccount` (use/account/use-account.ts:41) as `not_logged_in` (exit 4, Auth) when the selected account exists in the Registry but the token store has no credential for it on that host (`store.read(host, target) === ''`). Distinct from error 35: the account is known but not authenticated. The hint points to `difyctl auth login --host <host>`.
Source
Thrown at cli/src/commands/use/account/use-account.ts:41
const cs = colorScheme(colorEnabled(opts.io.isErrTTY))
const reg = await Registry.load()
if (reg.current_host === undefined) throw notLoggedInError(USE_HOST_HINT)
const host = reg.current_host
const entry = reg.hosts[host]
if (entry === undefined) throw notLoggedInError(USE_HOST_HINT)
const emails = Object.keys(entry.accounts)
const target = opts.email ?? (await pickAccount(opts, entry, host))
if (!emails.includes(target)) {
throw new BaseError({
code: ErrorCode.UsageInvalidFlag,
message: `unknown account "${target}" on ${host}; known: ${emails.join(', ')}`,
})
}
const store = opts.store ?? getTokenStore(reg.token_storage)
if ((await store.read(host, target)) === '') {
throw new BaseError({
code: ErrorCode.NotLoggedIn,
message: `no credential stored for ${target} on ${host}`,
hint: `run 'difyctl auth login --host ${host}'`,
})
}
reg.setAccount(target)
await reg.save()
opts.io.out.write(`${cs.successIcon()} Active account on ${host} is now ${target}\n`)
}
async function pickAccount(
opts: UseAccountOptions,
entry: HostEntry,
host: string,
): Promise<string> {
const emails = Object.keys(entry.accounts)
if (!opts.io.isErrTTY) {View on GitHub (pinned to ef8544b173)
Solutions
- Re-authenticate: `difyctl auth login --host <host>` (selecting that account).
- If using a keyring backend, verify it is accessible (not locked/disabled).
- Confirm the token store type in the Registry matches what holds the credential.
Defensive patterns
Strategy: try-catch
Validate before calling
const store = getTokenStore(reg.token_storage) const hasCred = (await store.read(host, target)) !== ''
Try / catch
try {
await runUseAccount(opts)
} catch (err) {
if (err instanceof BaseError && err.code === ErrorCode.NotLoggedIn) {
// run `difyctl auth login --host <host>` then retry
}
throw err
} Prevention
- Run `difyctl auth login --host <host>` to populate the credential for the account.
- Verify the OS keyring is unlocked and accessible.
- Confirm the token store backend in the Registry matches where credentials live.
When it happens
Trigger: An account entry exists in `hosts[host].accounts` (so error 35 passes) but its stored token is empty — e.g. the credential was cleared, the keyring entry was deleted, or login was never completed for this account on this host.
Common situations: OS keyring was reset/cleared; token revoked or expired and removed; account added to registry by a sync but never logged in here; token store backend changed.
Related errors
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/08cf52fc5a01b197.
Report an issue: GitHub.