{"record":{"id":"972423430ea4168e","repo":"googleapis/mcp-toolbox","slug":"failed-to-initialize-alloydb-source-in-read-only-m","errorCode":null,"errorMessage":"failed to initialize AlloyDB source in read-only mode: 'alloydb_session_read_only' is not supported on this instance version. See documentation for details: https://mcp-toolbox.dev/integrations/alloydb/source/#reference: %w","messagePattern":"failed to initialize AlloyDB source in read-only mode: 'alloydb_session_read_only' is not supported on this instance version\\. See documentation for details: https://mcp-toolbox\\.dev/integrations/alloydb/source/#reference: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/alloydbpg/alloydb_pg.go","lineNumber":83,"sourceCode":"}\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\tpool, err := initAlloyDBPgConnectionPool(ctx, tracer, r.Name, r.Project, r.Region, r.Cluster, r.Instance, r.IPType.String(), r.User, r.Password, r.Database, r.ReadOnly)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create pool: %w\", err)\n\t}\n\n\terr = pool.Ping(ctx)\n\tif err != nil {\n\t\tpool.Close()\n\t\tif r.ReadOnly &&\n\t\t\tstrings.Contains(err.Error(), \"unrecognized configuration parameter\") &&\n\t\t\tstrings.Contains(err.Error(), \"alloydb_session_read_only\") {\n\t\t\treturn nil, fmt.Errorf(\"failed to initialize AlloyDB source in read-only mode: 'alloydb_session_read_only' is not supported on this instance version. See documentation for details: https://mcp-toolbox.dev/integrations/alloydb/source/#reference: %w\", err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"unable to connect successfully: %w\", err)\n\t}\n\n\ts := &Source{\n\t\tConfig: r,\n\t\tPool:   pool,\n\t}\n\treturn s, nil\n}\n\nvar _ sources.Source = &Source{}\n\ntype Source struct {\n\tConfig\n\tPool *pgxpool.Pool\n}\n","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/alloydbpg/alloydb_pg.go#L65-L101","documentation":"When a read-only alloydbpg source pings the database, it sets the alloydb_session_read_only configuration parameter. On older AlloyDB instance versions this parameter doesn't exist, and Postgres replies 'unrecognized configuration parameter'. The source detects this specific failure during pool.Ping and returns this descriptive error, closing the pool first.","triggerScenarios":"Configuring `readOnly: true` on an alloydb-postgres source whose target AlloyDB instance runs a version that predates support for the alloydb_session_read_only parameter; the Ping fails with 'unrecognized configuration parameter: alloydb_session_read_only'.","commonSituations":"Connecting to an AlloyDB instance that hasn't been upgraded to a version supporting session-level read-only enforcement, often after enabling readOnly in a toolbox config copied from docs.","solutions":["Upgrade the AlloyDB instance to a version supporting alloydb_session_read_only.","Set readOnly: false in the source config until the instance is upgraded.","Verify instance version in the Google Cloud console or via `gcloud alloydb instances describe`.","Check the linked docs (mcp-toolbox.dev alloydb source reference) for supported versions."],"exampleFix":"// before\nsources:\n  alloydb-src:\n    kind: alloydb-postgres\n    readOnly: true   # unsupported on this instance version\n// after\nsources:\n  alloydb-src:\n    kind: alloydb-postgres\n    readOnly: false  # or upgrade the AlloyDB instance first","handlingStrategy":"validation","validationCode":"# Confirm the instance version supports alloydb_session_read_only before enabling readOnly\ngcloud alloydb instances describe INSTANCE --cluster=CLUSTER --region=REGION --format=\"value(name,activationPolicy)\"\n# test the parameter directly:\npsql \"...\" -c \"SET alloydb_session_read_only = on;\"","typeGuard":null,"tryCatchPattern":"src, err := cfg.Initialize(ctx, tracer)\nif err != nil && strings.Contains(err.Error(), \"alloydb_session_read_only\") {\n    // fall back to a non-read-only source or schedule an instance upgrade\n    log.Warn(\"readOnly unsupported on this instance version; disable readOnly or upgrade\")\n}","preventionTips":["Check supported versions in the docs before enabling readOnly","Test SET alloydb_session_read_only=on in psql against staging first","Keep AlloyDB instances on recent maintenance versions","Document readOnly requirements in your deployment config review"],"tags":["go","alloydb","read-only","configuration","version-compatibility"],"backgroundTag":"unsupported-database-parameter","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"}