mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[PR #5020] [CLOSED] Improve error messages for misplaced client-level configuration fields #5102
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#5102
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fatedier/frp/pull/5020
Author: @Copilot
Created: 10/15/2025
Status: ❌ Closed
Base:
dev← Head:copilot/fix-unmarshal-proxyconfig-error📝 Commits (3)
9131d72Initial planb9f909dImprove error messages for misplaced client-level config fieldsd4eb63bMove clientLevelFields to common.go for shared access📊 Changes
4 files changed (+156 additions, -2 deletions)
View changed files
📝
pkg/config/v1/common.go(+22 -0)📝
pkg/config/v1/proxy.go(+28 -1)📝
pkg/config/v1/proxy_test.go(+78 -0)📝
pkg/config/v1/visitor.go(+28 -1)📄 Description
Problem
Users were receiving cryptic error messages when accidentally placing client-level configuration fields inside proxy or visitor sections. For example, when trying to configure the VirtualNet feature as shown in the issue #4483:
The error message was unhelpful:
This left users confused about what
featureGatesis, where it should be placed, and how to fix their configuration.Solution
Enhanced the JSON unmarshaling error messages to detect when client-level configuration fields are mistakenly placed in proxy or visitor configurations and provide clear, actionable guidance.
Changes
Added
clientLevelFieldslist incommon.go- Maintains a centralized list of 16 common client-level fields (featureGates, virtualNet, auth, serverAddr, serverPort, log, webServer, transport, etc.)Added
enhanceProxyConfigError()function - Detects misplaced fields in proxy configurations and provides helpful error messagesAdded
enhanceVisitorConfigError()function - Detects misplaced fields in visitor configurations and provides helpful error messagesAdded comprehensive unit tests - Tests cover multiple scenarios including featureGates, virtualNet, and auth field misplacement
Result
Now when users make the same mistake, they receive a clear, actionable error message:
The correct configuration should be:
Benefits
Testing
Fixes #4483
Original prompt
Fixes fatedier/frp#5019
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.