MCPcopy
hub / github.com/claude-code-best/claude-code / getFastModeUnavailableReason

Function getFastModeUnavailableReason

src/utils/fastMode.ts:72–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70}
71
72export function getFastModeUnavailableReason(): string | null {
73 if (!isFastModeEnabled()) {
74 return 'Fast mode is not available'
75 }
76
77 const statigReason = getFeatureValue_CACHED_MAY_BE_STALE(
78 'tengu_penguins_off',
79 null,
80 )
81 // Statsig reason has priority over other reasons.
82 if (statigReason !== null) {
83 logForDebugging(`Fast mode unavailable: ${statigReason}`)
84 return statigReason
85 }
86
87 // Previously, fast mode required the native binary (bun build). This is no
88 // longer necessary, but we keep this option behind a flag just in case.
89 if (
90 !isInBundledMode() &&
91 getFeatureValue_CACHED_MAY_BE_STALE('tengu_marble_sandcastle', false)
92 ) {
93 return 'Fast mode requires the native binary · Install from: https://claude.com/product/claude-code'
94 }
95
96 // Not available in the SDK unless explicitly opted in via --settings.
97 // Assistant daemon mode is exempt — it's first-party orchestration, and
98 // kairosActive is set before this check runs (main.tsx:~1626 vs ~3249).
99 if (
100 getIsNonInteractiveSession() &&
101 preferThirdPartyAuthentication() &&
102 !getKairosActive()
103 ) {
104 const flagFastMode = getSettingsForSource('flagSettings')?.fastMode
105 if (!flagFastMode) {
106 const reason = 'Fast mode is not available in the Agent SDK'
107 logForDebugging(`Fast mode unavailable: ${reason}`)
108 return reason
109 }
110 }
111
112 // Only available for 1P (not Bedrock/Vertex/Foundry)
113 if (getAPIProvider() !== 'firstParty') {
114 const reason = 'Fast mode is not available on Bedrock, Vertex, or Foundry'
115 logForDebugging(`Fast mode unavailable: ${reason}`)
116 return reason
117 }
118
119 if (orgStatus.status === 'disabled') {
120 if (
121 orgStatus.reason === 'network_error' ||
122 orgStatus.reason === 'unknown'
123 ) {
124 // The org check can fail behind corporate proxies that block the
125 // endpoint. We add CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS=1 to
126 // bypass this check in the CC binary. This is OK since we have
127 // another check in the API to error out when disabled by org.
128 if (isEnvTruthy(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS)) {
129 return null

Callers 4

PromptInputFunction · 0.85
isFastModeAvailableFunction · 0.85
handleFastModeShortcutFunction · 0.85
callFunction · 0.85

Calls 11

isFastModeEnabledFunction · 0.85
isInBundledModeFunction · 0.85
getKairosActiveFunction · 0.85
getSettingsForSourceFunction · 0.85
getAPIProviderFunction · 0.85
getDisabledReasonMessageFunction · 0.85
logForDebuggingFunction · 0.70
isEnvTruthyFunction · 0.70

Tested by

no test coverage detected