{"record":{"id":"4670ef1a006fa6bc","repo":"apache/answer","slug":"get-config-failed-w-4670ef","errorCode":null,"errorMessage":"get config failed: %w","messagePattern":"get config failed: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/migrations/v13.go","lineNumber":63,"sourceCode":"\t\tupdateUserQuestionCount,\n\t\tupdateUserAnswerCount,\n\t\tinBoxData,\n\t}\n\tfor _, fn := range fns {\n\t\tif err := fn(ctx, x); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc addGravatarBaseURL(ctx context.Context, x *xorm.Engine) error {\n\tusersSiteInfo := &entity.SiteInfo{\n\t\tType: constant.SiteTypeUsers,\n\t}\n\texist, err := x.Context(ctx).Get(usersSiteInfo)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get config failed: %w\", err)\n\t}\n\tif exist {\n\t\tcontent := &schema.SiteUsersReq{}\n\t\t_ = json.Unmarshal([]byte(usersSiteInfo.Content), content)\n\t\tcontent.GravatarBaseURL = \"https://www.gravatar.com/avatar/\"\n\t\tdata, _ := json.Marshal(content)\n\t\tusersSiteInfo.Content = string(data)\n\n\t\t_, err = x.Context(ctx).ID(usersSiteInfo.ID).Cols(\"content\").Update(usersSiteInfo)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"update site info failed: %w\", err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc addPrivilegeForInviteSomeoneToAnswer(ctx context.Context, x *xorm.Engine) error {\n\t// add rank for invite to answer","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/apache/answer/blob/3b9f1370612e690a0b7f230f05e688930db4c6d3/internal/migrations/v13.go#L45-L81","documentation":"Returned by addGravatarBaseURL in internal/migrations/v13.go when the xorm Get() lookup of the users SiteInfo row fails. The migration must read this row to add gravatar_base_url to its JSON content. The driver error is wrapped with %w.","triggerScenarios":"x.Context(ctx).Get(usersSiteInfo) where usersSiteInfo = &entity.SiteInfo{Type: constant.SiteTypeUsers} returns non-nil err during the v13 migration.","commonSituations":"site_info table missing or corrupted; DB unreachable during upgrade; type column mismatch preventing the query from matching/executing.","solutions":["Check the wrapped driver error for the exact cause","Verify the site_info table exists with the expected schema","Confirm DB connectivity and privileges, then re-run the migration"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// verify the users site info row exists and is readable\nrow := db.QueryRow(\"SELECT id FROM site_info WHERE type = 'users' LIMIT 1\")\nvar id int64\nif err := row.Scan(&id); err != nil {\n\tlog.Println(\"users site_info row missing or unreadable:\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := runMigrations(); err != nil {\n\tif strings.Contains(err.Error(), \"get config failed\") {\n\t\tlog.Fatalf(\"site_info read failed, cause: %v\", errors.Unwrap(err))\n\t}\n}","preventionTips":["Back up site_info before upgrading","Verify site_info schema matches entity.SiteInfo","Check DB connectivity before starting migrations","Complete prior migrations before v13"],"tags":["database","migration","xorm","site-info"],"backgroundTag":"migration-db-query-failed","analyzedSha":"3b9f1370612e690a0b7f230f05e688930db4c6d3","analyzedAt":"2026-09-05T18:18:39.533Z","contentChangedAt":"2026-09-05T18:18:39.533Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}