{"record":{"id":"97eaeed7739497f9","repo":"googleapis/mcp-toolbox","slug":"unable-to-create-connection-w","errorCode":null,"errorMessage":"unable to create connection: %w","messagePattern":"unable to create connection: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/snowflake/snowflake.go","lineNumber":66,"sourceCode":"\tName      string `yaml:\"name\" validate:\"required\"`\n\tType      string `yaml:\"type\" validate:\"required\"`\n\tAccount   string `yaml:\"account\" validate:\"required\"`\n\tUser      string `yaml:\"user\" validate:\"required\"`\n\tPassword  string `yaml:\"password\" validate:\"required\"`\n\tDatabase  string `yaml:\"database\" validate:\"required\"`\n\tSchema    string `yaml:\"schema\" validate:\"required\"`\n\tWarehouse string `yaml:\"warehouse\"`\n\tRole      string `yaml:\"role\"`\n}\n\nfunc (r Config) SourceConfigType() string {\n\treturn SourceType\n}\n\nfunc (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {\n\tdb, err := initSnowflakeConnection(ctx, tracer, r.Name, r.Account, r.User, r.Password, r.Database, r.Schema, r.Warehouse, r.Role)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create connection: %w\", err)\n\t}\n\n\terr = db.PingContext(ctx)\n\tif err != nil {\n\t\tdb.Close()\n\t\treturn nil, fmt.Errorf(\"unable to connect successfully: %w\", err)\n\t}\n\n\ts := &Source{\n\t\tConfig: r,\n\t\tDB:     db,\n\t}\n\treturn s, nil\n}\n\nvar _ sources.Source = &Source{}\n\ntype Source struct {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/snowflake/snowflake.go#L48-L84","documentation":"Snowflake's Config.Initialize wraps initSnowflakeConnection errors with this message. This means constructing the snowflake driver connection (building the config/DSN from account, user, password, database, schema, warehouse, role) failed before any ping — typically invalid or missing connection parameters rather than a network failure. Initialization aborts and no source is registered.","triggerScenarios":"Calling Initialize with an invalid account identifier format, empty required fields (account/user/password), or driver-level config validation failure (bad role, malformed account like including the full URL, unsupported auth configuration).","commonSituations":"Using the full account URL instead of the account identifier (e.g. \"https://org-name.account.snowflakecomputing.com\" instead of \"orgname-accountname\"), missing password for password auth, wrong region suffix format, or a role/warehouse name that doesn't exist caught at config build time.","solutions":["Verify the account identifier format: use <orgname>-<account_name> (e.g. myorg-myaccount), not a URL.","Confirm account, user, and password are all set and non-empty in the source config.","Check database, schema, warehouse, and role names exist in Snowflake (SHOW ROLES / SHOW WAREHOUSES).","Read the wrapped driver error for the precise parameter problem.","Test credentials with snowsql or the Snowflake web UI using the same values."],"exampleFix":"// before\naccount: https://myorg-myacct.snowflakecomputing.com\n// after\naccount: myorg-myacct","handlingStrategy":"validation","validationCode":"// Validate Snowflake params before Initialize\nfunc validateSnowflakeConfig(account, user, password string) error {\n    if account == \"\" || user == \"\" || password == \"\" { return errors.New(\"account, user and password are required\") }\n    if strings.Contains(account, \"snowflakecomputing.com\") || strings.HasPrefix(account, \"http\") {\n        return fmt.Errorf(\"account must be an identifier like 'org-account', got %q\", account)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"src, err := cfg.Initialize(ctx, tracer)\nif err != nil && strings.Contains(err.Error(), \"unable to create connection\") {\n    return fmt.Errorf(\"check account identifier (org-account) and credentials: %w\", err)\n}\n// subsequent ping error handled separately","preventionTips":["Use the <orgname>-<account_name> identifier, never the URL","Confirm user/password and role/warehouse names exist","Test with snowsql before configuring","Keep account metadata in checked-in, secret-free config with env-var injection"],"tags":["snowflake","config","connection","validation"],"backgroundTag":"invalid-dsn","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}