gRPC Error Signals (grpcerrors/errors.go)

LocalAI · pkg/grpc/grpcerrors/errors.go · go · MIT
dev-tools, integration, tag:errors, tag:status-codes, tag:backend, tag:router

Defines shared well-known gRPC error helpers so backends and routers can detect conditions like model-not-loaded via status codes across the gRPC boundary.

// Source: https://github.com/mudler/LocalAI | License: MIT | Copyright 2023-2025 Ettore Di Giacinto (mudler@localai.io)
// Provided via justclaw.it.com; keep this notice with the code.
// Package grpcerrors defines well-known error signals shared between backends
// (which produce them) and the router (which consumes them). Go error types do
// not survive the gRPC boundary, so these conditions are carried as gRPC status
// codes and detected via the code rather than by matching the error message.
package grpcerrors

import (
	"strings"

	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
)

// ModelNotLoaded returns the canonical error a backend returns when it has no
// model loaded for the request. It carries codes.FailedPrecondition so callers
// can detect it across the 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key