Skip to content

Bug: provider not registered: <name> when creating agent with DashScope provider #200

@hoangvinh14

Description

@hoangvinh14

Summary

When a user creates a DashScope provider with a custom name (e.g. myqwen) and then tries to create an agent using that provider, the "Check & Create" step fails with:

provider not registered: myqwen

Root Cause

DashScopeProvider.Name() hardcodes the return value "dashscope" regardless of the name stored in the database:

// internal/providers/dashscope.go
func (p *DashScopeProvider) Name() string { return "dashscope" } // ← hardcoded

When registerInMemory is called after provider creation, the provider is registered into the in-memory registry under the key "dashscope". However, the verify endpoint (POST /v1/providers/{id}/verify) looks up the registry using p.Name from the DB record (e.g. "myqwen"), which doesn't match → lookup fails.

// internal/http/providers.go — registerInMemory
case store.ProviderDashScope:
    h.providerReg.Register(providers.NewDashScopeProvider(p.APIKey, p.APIBase, ""))
    // registered as "dashscope", not "myqwen"

// internal/http/provider_verify.go
provider, err := h.providerReg.Get(p.Name) // looks for "myqwen" → not found

This is inconsistent with OpenAIProvider (used in the default case), which correctly accepts name as the first parameter and returns it from Name().

Workaround

Name the provider exactly dashscope when creating it in the Dashboard. Verification and agent creation will then work correctly.

Proposed Fix

Add a name parameter to [NewDashScopeProvider]goclaw/internal/providers/dashscope.go:20:0-30:1) (like NewOpenAIProvider) and return it from Name(), then pass p.Name from the DB at all call sites in registerInMemory and registerProvidersFromDB.

Affected files

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions