MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / isModelNotFoundError

Function isModelNotFoundError

src/utils/errors.ts:98–143  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

96}
97
98export function isModelNotFoundError(error: unknown): boolean {
99 if (error instanceof ModelNotFoundError) {
100 return true;
101 }
102
103 if (error instanceof Error) {
104 const message = error.message.toLowerCase();
105
106 // OpenAI error patterns
107 if (
108 message.includes('model') &&
109 (message.includes('not found') ||
110 message.includes('does not exist') ||
111 message.includes('invalid model'))
112 ) {
113 return true;
114 }
115
116 // Anthropic error patterns
117 if (
118 message.includes('model') &&
119 (message.includes('not found') || message.includes('invalid'))
120 ) {
121 return true;
122 }
123
124 // Check for 404 status in axios/fetch errors
125 if (
126 'status' in (error as any) &&
127 (error as any).status === 404 &&
128 message.includes('model')
129 ) {
130 return true;
131 }
132
133 // Check for response status
134 if ('response' in (error as any)) {
135 const response = (error as any).response;
136 if (response?.status === 404) {
137 return true;
138 }
139 }
140 }
141
142 return false;
143}
144
145export function isApiKeyError(error: unknown): boolean {
146 if (error instanceof ApiKeyMissingError) {

Callers 2

formatUserFriendlyErrorFunction · 0.70

Calls 2

toLowerCaseMethod · 0.80
includesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…