{"record":{"id":"65dcdc9f661c72d4","repo":"siyuan-note/siyuan","slug":"result-msg-cloud-server-message","errorCode":null,"errorMessage":"result[\"msg\"] (cloud server message)","messagePattern":"result\\[\"msg\"\\] \\(cloud server message\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/cloud_service.go","lineNumber":576,"sourceCode":"\t\tlogging.LogErrorf(\"remove cloud shorthands failed: %s\", err)\n\t\terr = ErrFailedToConnectCloudServer\n\t\treturn\n\t}\n\n\tif http.StatusUnauthorized == resp.StatusCode {\n\t\tinvalidUser()\n\t\terr = errors.New(Conf.Language(31))\n\t\treturn\n\t}\n\tif http.StatusOK != resp.StatusCode {\n\t\terr = ErrFailedToConnectCloudServer\n\t\treturn\n\t}\n\n\tcode := result[\"code\"].(float64)\n\tif 0 != code {\n\t\tlogging.LogErrorf(\"remove cloud shorthands failed: %s\", result[\"msg\"])\n\t\terr = errors.New(result[\"msg\"].(string))\n\t\treturn\n\t}\n\treturn\n}\n\nfunc GetCloudShorthand(id string) (ret map[string]any, err error) {\n\tuser := Conf.GetUser()\n\tif user == nil {\n\t\treturn nil, errors.New(Conf.Language(31))\n\t}\n\tinvalidUser := cloudAccountAuthFailureHandler(user.UserToken)\n\tresult := map[string]any{}\n\trequest := httpclient.NewCloudRequest30s()\n\tresp, err := request.\n\t\tSetSuccessResult(&result).\n\t\tSetCookies(&http.Cookie{Name: \"symphony\", Value: user.UserToken}).\n\t\tPost(util.GetCloudServer() + \"/apis/siyuan/inbox/getCloudShorthand?id=\" + id)\n\tif err != nil {","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/cloud_service.go#L558-L594","documentation":"When the cloud server responds 200 but the JSON envelope's code field is non-zero, the request reached the server but the business operation failed. The server's msg field is logged and returned verbatim as the error (result[\"msg\"].(string)). This error text is produced by the remote siyuan cloud API, not by local validation.","triggerScenarios":"POST /apis/siyuan/inbox/removeCloudShorthands returns {code: !=0, msg: ...} — e.g. shorthand IDs that do not exist or belong to another account, rate limiting, or server-side restrictions on the operation.","commonSituations":"Passing stale shorthand IDs collected before the item was already deleted (or on the server) elsewhere; calling with IDs from a different account; cloud service maintenance or throttling producing server-defined error messages.","solutions":["Read the returned msg (it is also in the kernel log as 'remove cloud shorthands failed: ...') to identify the server-side cause","Refresh the shorthand list (GetCloudShorthands) and retry only with currently existing IDs","Retry after a delay if msg indicates throttling or a transient server condition","If the msg is persistent for valid IDs, check cloud service status / report the server error"],"exampleFix":"// before\nids := allCachedIds\nerr := model.RemoveCloudShorthands(ids) // server may reject unknown ids\n// after\nshorthands, err := model.GetCloudShorthands(0) // refresh first\n// build ids from shorthands[\"data\"].(map[string]any)[\"shorthands\"] then retry","handlingStrategy":"try-catch","validationCode":"// verify ids exist before removing\nlist, _ := model.GetCloudShorthands(0)\nexisting := shorthandIdSet(list)\nfor _, id := range ids { if !existing[id] { return fmt.Errorf(\"unknown shorthand %s\", id) } }","typeGuard":null,"tryCatchPattern":"if err := model.RemoveCloudShorthands(ids); err != nil {\n    logging.LogWarnf(\"server rejected removal: %v\", err)\n    return err\n}","preventionTips":["Refresh the shorthand list before mutating by ID","Do not retry blindly on business-code errors; read msg first","Keep IDs from the same account session"],"tags":["cloud","api","remote-error"],"backgroundTag":"api-error-response","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}