{"record":{"id":"9c679cde5e1fbb34","repo":"fatedier/frp","slug":"invalid-argument-proxy-name-in-url-must-match-nam","errorCode":null,"errorMessage":"invalid argument: proxy name in URL must match name in body","messagePattern":"invalid argument: proxy name in URL must match name in body","errorType":"http","errorClass":"configmgmt.ErrInvalidArgument","httpStatus":400,"severity":"error","filePath":"client/config_manager.go","lineNumber":209,"sourceCode":"\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Infof(\"store: created proxy %q\", name)\n\treturn persisted, nil\n}\n\nfunc (m *serviceConfigManager) UpdateStoreProxy(name string, cfg v1.ProxyConfigurer) (v1.ProxyConfigurer, error) {\n\tif name == \"\" {\n\t\treturn nil, fmt.Errorf(\"%w: proxy name is required\", configmgmt.ErrInvalidArgument)\n\t}\n\tif cfg == nil {\n\t\treturn nil, fmt.Errorf(\"%w: invalid proxy config: type is required\", configmgmt.ErrInvalidArgument)\n\t}\n\tbodyName := cfg.GetBaseConfig().Name\n\tif bodyName != name {\n\t\treturn nil, fmt.Errorf(\"%w: proxy name in URL must match name in body\", configmgmt.ErrInvalidArgument)\n\t}\n\tif err := m.validateStoreProxyConfigurer(cfg); err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: validation error: %v\", configmgmt.ErrInvalidArgument, err)\n\t}\n\n\tpersisted, err := m.withStoreProxyMutationAndReload(name, func(storeSource *source.StoreSource) error {\n\t\tif err := storeSource.UpdateProxy(cfg); err != nil {\n\t\t\tif errors.Is(err, source.ErrNotFound) {\n\t\t\t\treturn fmt.Errorf(\"%w: %v\", configmgmt.ErrNotFound, err)\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/fatedier/frp/blob/6c8a8d0a97d03b44e9528d30b30c70cb9d61b405/client/config_manager.go#L191-L227","documentation":"Returned by UpdateStoreProxy when the name in the URL path and the name inside the request body differ (bodyName != name). frpc enforces REST consistency so a PUT cannot silently rename an object; rename is delete-then-create. Maps to HTTP 400 via ErrInvalidArgument.","triggerScenarios":"PUT /api/store/proxies/old-name with a body whose \"name\" field is \"new-name\"; automation that updates the body's name field but builds the URL from a stale variable; renaming attempts.","commonSituations":"Scripts where the URL name comes from CLI args but the body is a rendered template with a different name; editing a fetched config and changing name as a 'label' without realizing it is the identifier.","solutions":["Make the body's name field exactly equal the URL name, or go straight to delete + create with the new name.","In tooling, derive both URL and body name from a single variable.","If renaming is the goal: DELETE /api/store/proxies/old then POST /api/store/proxies with name=new."],"exampleFix":"# before\ncurl -X PUT http://127.0.0.1:7400/api/store/proxies/ssh \\\n  -d '{\"type\":\"tcp\",\"name\":\"ssh-v2\",\"localPort\":22,\"remotePort\":6022}'\n# 400 proxy name in URL must match name in body\n\n# after\ncurl -X PUT http://127.0.0.1:7400/api/store/proxies/ssh \\\n  -d '{\"type\":\"tcp\",\"name\":\"ssh\",\"localPort\":22,\"remotePort\":6022}'","handlingStrategy":"validation","validationCode":"// Enforce URL/body name equality client-side.\nif cfg.GetBaseConfig().Name != name {\n    return fmt.Errorf(\"name mismatch: url=%s body=%s\", name, cfg.GetBaseConfig().Name)\n}\n_, err := mgr.UpdateStoreProxy(name, cfg)","typeGuard":null,"tryCatchPattern":"if _, err := mgr.UpdateStoreProxy(name, cfg); err != nil {\n    if errors.Is(err, configmgmt.ErrInvalidArgument) && strings.Contains(err.Error(), \"must match\") {\n        // align the two names or do delete+create to rename\n    }\n}","preventionTips":["Never edit the body name field during PUT updates","For renames, script DELETE + POST explicitly"],"tags":["frp","frpc","store","proxy","validation","rest"],"backgroundTag":null,"analyzedSha":"6c8a8d0a97d03b44e9528d30b30c70cb9d61b405","analyzedAt":"2026-08-15T06:53:27.215Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}