{"record":{"id":"07f53aa080522ca2","repo":"CherryHQ/cherry-studio","slug":"string-firstpublishererror","errorCode":null,"errorMessage":"String(firstPublisherError)","messagePattern":"String\\(firstPublisherError\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ai/provider/listModels.ts","lineNumber":288,"sourceCode":"          if (firstPublisherError === undefined) {\n            firstPublisherError = error\n          }\n          logger.warn('Skipping Vertex publisher model listing after request failure', {\n            providerId: provider.id,\n            publisher,\n            error: error instanceof Error ? error.message : String(error)\n          })\n          return null\n        }\n      })\n    )\n\n    if (options?.throwOnError && publisherModelGroups.some((g) => g === null)) {\n      if (firstPublisherError instanceof Error) {\n        throw firstPublisherError\n      }\n      if (firstPublisherError !== undefined) {\n        throw new Error(String(firstPublisherError))\n      }\n      throw new Error('One or more Vertex AI publisher requests failed')\n    }\n\n    const publisherModels = publisherModelGroups.filter((g) => g !== null).flat()\n\n    const listedModels = dedup(publisherModels, (model) => model.name).map((model) => {\n      const bareId = getVertexModelId(model.name)\n      const ownedBy = getVertexModelPublisher(model.name)\n      // MaaS models are served over the OpenAI-compatible endpoint, which requires the\n      // `{publisher}/{model}` id form even when Google is the publisher. Native Google\n      // models (Gemini/Gemma/embeddings) keep their bare id.\n      const publisherModelId = `${ownedBy}/${bareId}`\n      const apiModelId = isVertexMaasModelId(publisherModelId) ? publisherModelId : bareId\n      return toModel(apiModelId, provider, {\n        name: pickPreferredString([model.displayName, bareId]) || bareId,\n        description: model.description,\n        ownedBy","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/CherryHQ/cherry-studio/blob/726446b54cd69ffe51a276638672f6d95ca0768c/src/main/ai/provider/listModels.ts#L270-L306","documentation":"Error \"String(firstPublisherError)\" thrown in CherryHQ/cherry-studio.","triggerScenarios":"Vertex AI publisher model listing is requested with throwOnError and at least one publisher request failed with a non-Error thrown value, which is stringified and re-thrown.","commonSituations":"Occurs when listing Vertex publisher models (Gemini/Gemma/MaaS) and one or more publisher endpoints fail — auth errors, network failures, or region unavailability — while the caller opted into fail-fast behavior instead of skipping failed publishers.","solutions":["Inspect the first publisher error message included in the error to identify which publisher request failed and why.","Verify Vertex AI credentials (service account, project, region) and that the Model Garden API is enabled.","Check network access to the Vertex AI endpoints; retry after transient failures."],"exampleFix":"Fix the underlying cause reported by the first publisher error, e.g. grant aiplatform.models.list permission to the service account.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"726446b54cd69ffe51a276638672f6d95ca0768c","analyzedAt":"2026-08-12T17:30:37.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}