flipped-aurora/gin-vue-admin · error
request failed: %s %s
Error message
request failed: %s %s
What it means
The gva CLI runner sends a manifest-defined command as an HTTP request to the gva server. Any response with status >= 400 is converted into this error containing the HTTP status line plus the response body, so the server-side error message surfaces directly in the CLI.
Source
Thrown at server/cmd/gva/runner.go:53
header = "x-token"
}
req.Header.Set(header, cfg.Token)
}
if len(payload) > 0 {
contentType := def.ContentType
if contentType == "" {
contentType = "application/json"
}
req.Header.Set("Content-Type", contentType)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode >= http.StatusBadRequest {
body, _ := io.ReadAll(resp.Body)
return fmt.Errorf("request failed: %s %s", resp.Status, strings.TrimSpace(string(body)))
}
_, err = io.Copy(cmd.OutOrStdout(), resp.Body)
return err
}
func buildRequestPayload(def ManifestCommand, cmd *cobra.Command) ([]byte, string, error) {
path := def.Path
queryParts := make([]string, 0)
body := make(map[string]any)
for _, param := range def.Parameters {
value, err := cmd.Flags().GetString(param.Flag)
if err != nil {
return nil, "", err
}
if strings.TrimSpace(value) == "" {
continue
}
switch param.Location {View on GitHub (pinned to 3136500ef3)
Solutions
- Read resp.Status and the body in the error message for the server's actual reason
- If 401, re-login: gva login --token <new-token> to refresh the stored JWT
- If 403, check the user's Casbin API permissions in the gva admin
- If 400, compare the built payload against the target API's expected request struct
Defensive patterns
Strategy: try-catch
Try / catch
if err := runManifestCommand(cmd, def); err != nil {
var reqErr *RequestFailedError
if errors.As(err, &reqErr) && reqErr.Status == 401 {
// prompt re-login: gva login --token <new>
}
} Prevention
- Refresh the stored JWT proactively before expiry
- Verify Casbin permissions for the target API before automating calls
- Log the full request payload when debugging 400s
When it happens
Trigger: The server responds 4xx/5xx to the CLI request: invalid/expired JWT (401), Casbin denial (403), bad payload (400/422), or server error (500).
Common situations: Token in local CLI config expired; user lacks permission for the target API; request payload built by buildRequestPayload doesn't match the API contract; server is erroring.
Related errors
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/c1fd18d15284ff98.
Report an issue: GitHub.