{"record":{"id":"9efc0af1dfcacd2d","repo":"googleapis/mcp-toolbox","slug":"tool-q-config-error-parameter-q-cannot-copy-val","errorCode":null,"errorMessage":"tool %q config error: parameter %q cannot copy value from itself","messagePattern":"tool %q config error: parameter %q cannot copy value from itself","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/server/config.go","lineNumber":520,"sourceCode":"\t\t\t// Validate references\n\t\t\tfor i, rawP := range paramsList {\n\t\t\t\tpMap, ok := rawP.(map[string]any)\n\t\t\t\tif !ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tpName, _ := pMap[\"name\"].(string)\n\t\t\t\trefName, _ := pMap[\"valueFromParam\"].(string)\n\n\t\t\t\tif refName != \"\" {\n\t\t\t\t\t// Check if the referenced parameter exists\n\t\t\t\t\tif !validParamNames[refName] {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"tool %q config error: parameter %q (index %d) references '%q' in the 'valueFromParam' field, which is not a defined parameter\", name, pName, i, refName)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check for self-reference\n\t\t\t\t\tif refName == pName {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"tool %q config error: parameter %q cannot copy value from itself\", name, pName)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tdec, err := util.NewStrictDecoder(r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating decoder: %s\", err)\n\t}\n\ttoolCfg, err := tools.DecodeConfig(ctx, resourceType, name, dec)\n\tif err != nil {\n\t\tif errors.Is(err, tools.ErrUnknownToolType) && util.IgnoreUnknownToolsFromContext(ctx) {\n\t\t\tl, logErr := util.LoggerFromContext(ctx)\n\t\t\tif logErr == nil {\n\t\t\t\tl.WarnContext(ctx, fmt.Sprintf(\"Skipping unknown tool type %q for tool %q\", resourceType, name))\n\t\t\t}\n\t\t\treturn nil, nil","sourceCodeStart":502,"sourceCodeEnd":538,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/config.go#L502-L538","documentation":"A tool parameter's `valueFromParam` points to the parameter itself (refName == pName). Self-copying is a logical cycle that would produce no value, so it is explicitly rejected.","triggerScenarios":"A tools entry has a parameter like `- name: prompt\\n  valueFromParam: prompt` — typically from a copy-paste where the valueFromParam line was left pointing at the same parameter.","commonSituations":"Duplicating a parameter block and editing the name but not valueFromParam; misunderstanding valueFromParam as a default-value mechanism and filling it with the same name.","solutions":["Point valueFromParam at a different, existing parameter","Remove valueFromParam entirely if the parameter should hold its own value","Give the parameter a default/placeholder through its normal mechanism instead"],"exampleFix":"// before\n  - name: prompt\n    type: string\n    valueFromParam: prompt\n// after\n  - name: prompt\n    type: string\n    valueFromParam: default_prompt","handlingStrategy":"validation","validationCode":"func validateNoSelfRef(params []map[string]any) error {\n  for _, p := range params {\n    n, _ := p[\"name\"].(string)\n    r, _ := p[\"valueFromParam\"].(string)\n    if r != \"\" && r == n { return fmt.Errorf(\"parameter %q cannot copy value from itself\", n) }\n  }\n  return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After duplicating parameter blocks, update both name and valueFromParam","Treat valueFromParam strictly as a cross-parameter copy, never a default","Add a self-reference check to your config linter"],"tags":["config","tools","parameters","validation"],"backgroundTag":"invalid-parameter-reference","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"}