{"record":{"id":"32ce74708357a3d5","repo":"vitessio/vitess","slug":"unable-to-construct-a-localcontroller-instance-bec","errorCode":null,"errorMessage":"unable to construct a LocalController instance because param: %s is missing in params: %v","messagePattern":"unable to construct a LocalController instance because param: (.+?) is missing in params: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/schemamanager/local_controller.go","lineNumber":231,"sourceCode":"\t\t}\n\t}\n\tfmt.Fprintf(logFile, \"-- Rows returned: %d\\n\", rowsReturned)\n\tfmt.Fprintf(logFile, \"-- Rows affected: %d\\n\", rowsAffected)\n\tlogFile.WriteString(\"-- \\n\")\n\tfmt.Fprintf(logFile, \"-- ran in %fs\\n\", result.TotalTimeSpent.Seconds())\n\tlogFile.WriteString(\"-- Execution succeeded\\n\")\n\treturn nil\n}\n\nvar _ Controller = (*LocalController)(nil)\n\nfunc init() {\n\tRegisterControllerFactory(\n\t\t\"local\",\n\t\tfunc(params map[string]string) (Controller, error) {\n\t\t\tschemaChangeDir, ok := params[SchemaChangeDirName]\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unable to construct a LocalController instance because param: %s is missing in params: %v\", SchemaChangeDirName, params)\n\t\t\t}\n\t\t\treturn NewLocalController(schemaChangeDir), nil\n\t\t},\n\t)\n}\n","sourceCodeStart":213,"sourceCodeEnd":237,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/schemamanager/local_controller.go#L213-L237","documentation":"The 'local' schema manager controller factory requires the schema change directory parameter (SchemaChangeDirName, e.g. 'schema-change-dir') in the params map. When that key is missing, NewLocalController cannot be built and this error is returned at registration/lookup time. It names both the missing key and the full params map for diagnosis.","triggerScenarios":"Calling schemamanager.NewSchemaManager (or initSchema) with controller type 'local' but the params map lacking the schema-change-dir key.","commonSituations":"Misconfigured vtctl/vtctld schema change invocation where the local directory flag was omitted; programmatically building params and forgetting the constant key; copy-pasting config from a non-local controller type.","solutions":["Add the schema change directory to params under the SchemaChangeDirName key (flag: --schema-change-dir)","Verify the controller name/type actually matches your setup ('local' vs other registered controllers)","Check the error's params dump to confirm which keys were actually passed"],"exampleFix":"// before\nparams := map[string]string{\"controller\": \"local\"}\n// after\nparams := map[string]string{\"controller\": \"local\", \"schema-change-dir\": \"/vt/schema-change-dir\"}","handlingStrategy":"validation","validationCode":"if _, ok := params[\"schema-change-dir\"]; !ok {\n  return fmt.Errorf(\"--schema-change-dir is required for the local controller\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --schema-change-dir when using the local controller","Validate params maps in tests using schemamanager constants","Share a single config builder across tools"],"tags":["schemamanager","configuration","local-controller"],"backgroundTag":"missing-config-parameter","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}