@@ -19,11 +19,30 @@ import (
1919
2020// Source status constants matching the OpenAPI enum values
2121const (
22- SourceStatusAvailable = "available"
23- SourceStatusError = "error"
24- SourceStatusDisabled = "disabled"
22+ SourceStatusAvailable = "available"
23+ SourceStatusPartiallyAvailable = "partially-available"
24+ SourceStatusError = "error"
25+ SourceStatusDisabled = "disabled"
2526)
2627
28+ // PartiallyAvailableError indicates that a source loaded some models successfully
29+ // but encountered errors with others.
30+ type PartiallyAvailableError struct {
31+ FailedModels []string
32+ }
33+
34+ func (e * PartiallyAvailableError ) Error () string {
35+ return fmt .Sprintf ("Failed to fetch some models, ensure models exist and are accessible with given credentials. Failed models: %v" , e .FailedModels )
36+ }
37+
38+ func (e * PartiallyAvailableError ) Is (target error ) bool {
39+ _ , ok := target .(* PartiallyAvailableError )
40+ return ok
41+ }
42+
43+ // ErrPartiallyAvailable is used with errors.Is() to check for this error type.
44+ var ErrPartiallyAvailable error = & PartiallyAvailableError {}
45+
2746// ModelProviderRecord contains one model and its associated artifacts.
2847type ModelProviderRecord struct {
2948 Model dbmodels.CatalogModel
@@ -450,9 +469,9 @@ func (l *Loader) readProviderRecords(ctx context.Context) <-chan ModelProviderRe
450469 // Only save status if context is still valid (no reload in progress)
451470 if ctx .Err () == nil {
452471 // Check if there was a partial error (some models failed to load)
453- if r .Error != nil {
454- glog .Errorf ("%s: partial error after loading models: %v" , sourceID , r .Error )
455- l .saveSourceStatus (sourceID , SourceStatusError , r .Error .Error ())
472+ if errors . Is ( r .Error , ErrPartiallyAvailable ) {
473+ glog .Warningf ("%s: partial error after loading models: %v" , sourceID , r .Error )
474+ l .saveSourceStatus (sourceID , SourceStatusPartiallyAvailable , r .Error .Error ())
456475 } else {
457476 l .saveSourceStatus (sourceID , SourceStatusAvailable , "" )
458477 }
@@ -620,7 +639,7 @@ func (l *Loader) removeOrphanedModelsFromSource(sourceID string, valid mapset.Se
620639func (l * Loader ) saveSourceStatus (sourceID , status string , errorMsg string ) {
621640 // Validate status is a valid enum value
622641 switch status {
623- case SourceStatusAvailable , SourceStatusError , SourceStatusDisabled :
642+ case SourceStatusAvailable , SourceStatusPartiallyAvailable , SourceStatusError , SourceStatusDisabled :
624643 // valid
625644 default :
626645 glog .Errorf ("invalid status %q for source %s" , status , sourceID )
0 commit comments