Bug #118692 ClusterSet.addCluster() missing from MySQL Shell 8.4.5 JavaScript and Python APIs
Submitted: 21 Jul 21:06 Modified: 3 Sep 10:29
Reporter: KB Benton Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Shell General / Core Client Severity:S2 (Serious)
Version:8.4.5 (verified on EL9 build) OS:Any
Assigned to: CPU Architecture:Any

[21 Jul 21:06] KB Benton
Description:
In MySQL Shell 8.4.5, the ClusterSet object returned by dba.getClusterSet() does not expose the .addCluster() method, making it impossible to add clusters via JavaScript, Python, or external JS scripts — even though this is documented functionality.

Expected:

var cset = dba.getClusterSet();
cset.addCluster("lebDevCluster", { connection: ..., ipAllowlist: ..., label: ... });

should work in JS, Python via shell.run(...), or script file (mysqlsh --js -f).

Actual:

All attempts fail with:

Unknown identifier: addCluster (TypeError)

Confirmed in:
	•	Interactive JavaScript mode
	•	Python mode (AttributeError: unknown attribute: add_cluster)
	•	JS file passed to --js -f
	•	shell.run(...) in Python (AttributeError: unknown attribute: run)

Works properly in MySQL Shell 8.0.34 (according to ChatGPT). This is a regression in 8.4.5.

How to repeat:
How to Repeat:
	1.	Connect to any InnoDB Cluster in MySQL Shell 8.4.5:

mysqlsh --uri root@<cluster-node> --js

	2.	Attempt to add a cluster:

var cset = dba.getClusterSet();
cset.addCluster("someCluster", { connection: "...", ipAllowlist: "...", label: "..." });

	3.	Observe failure:
Unknown identifier: addCluster (TypeError)

Suggested fix:
Workaround:

Downgrade to MySQL Shell 8.0.34, where addCluster() works as expected.

⸻

Suggested Fix:

Restore addCluster() method to the ClusterSet JavaScript and Python bindings in MySQL Shell 8.4.x.

⸻

Environment:
	•	OS: Oracle Linux 9.5
	•	Shell: MySQL Shell 8.4.5
	•	Server: MySQL Server 8.4.5 (InnoDB Cluster + ClusterSet)
[22 Jul 6:47] MySQL Verification Team
Hello KB Benton,

Thank you for the report and feedback.
IMHO, JavaScript does not strictly require semicolons at the end of every statement. 
Could you please try without ";"? or am I missing anything here? Thank you.

mysql-js> var cluster1 = dba.getCluster()

Please see https://dev.mysql.com/doc/mysql-shell/8.4/en/retrieving-a-handler.html

regards,
Umesh
[22 Jul 15:23] KB Benton
$ strings `which mysqlsh` | grep addCluster
$

Umesh - I'm concerned that with or without semicolons, the addCluster method is not available.
[31 Jul 11:48] MySQL Verification Team
Hello KB Benton,

Thank you for the feedback.
I tried to repro and having similar issue(actually with dba.createClusterSet()), looks unusual to me hence verifying for now so that dev's can confirm if this is an issue etc. 

regards,
Umesh
[3 Sep 10:29] Miguel Araujo
There has never been a ClusterSet.addCluster() method in Shell's AdminAPI.

The documented and supported way to add a new replica cluster to a ClusterSet is:

  - JavaScript: ClusterSet.createReplicaCluster(instance, clusterName[, options])
  - Python: ClusterSet.create_replica_cluster(instance, clusterName[, options])

This has always been the case, as shown in the official documentation:

  - https://dev.mysql.com/doc/dev/mysqlsh-api-javascript/8.4/classmysqlsh_1_1dba_1_1_cluster_s...
  - https://dev.mysql.com/doc/dev/mysqlsh-api-python/8.4/classmysqlsh_1_1dba_1_1_cluster_set.h...
  - https://dev.mysql.com/doc/mysql-shell/en/innodb-clusterset.html

The statement that

  "Works properly in MySQL Shell 8.0.34 (according to ChatGPT). This is a regression in 8.4.5."

is completely false, and frankly painful to read. This method has never existed in any release.

Filing bugs based on ChatGPT guesses without checking the official documentation leads to false regression claims like this one and wastes engineering time.
Please verify against the docs or use \help in MySQL Shell before reporting a regression. At the very least, try the command yourself before making such claims!