R. Yaakov Gesundheit asks this question in his introduction to Tiferes Yaakov on Chulin. He answers that it is talking about someone who was mevatel Torah in order to do mitzvos, as per the general rule that performance of mitzvos overrides Torah study. Thus, the person has not sinned by shirking Torah study. However, since God desires his Torah study He afflicts him because one who is in pain is exempt from mitzvos. However, Torah study is the exception to this; one is never exempt from Torah study no matter his physical condition. As Rambam writes in Hilchos Talmud Torah 1:8:
כל איש מישראל חייב בתלמוד תורה בין עני בין עשיר בין שלם בגופו בין בעל
יסורין בין בחור בין שהיה זקן גדול שתשש כחו אפילו היה עני המתפרנס מן
הצדקה ומחזר על הפתחים ואפילו בעל אשה ובנים חייב לקבוע לו זמן לתלמוד
תורה ביום ובלילה שנאמר והגית בו יומם ולילה
Every Jewish man is obligated to study Torah, whether he is poor or
rich, whether his body is healthy and whole or afflicted by
difficulties, whether he is young or an old man whose strength has
diminished.
Even if he is a poor man who derives his livelihood from charity and
begs from door to door, even if he is a husband and [a father of]
children, he must establish a fixed time for Torah study during the
day and at night, as [Joshua 1:8] commands: "You shall think about it
day and night." (Chabad.org)
Thus, by giving this person afflictions God exempts him from other mitzvos and he can now devote himself to Torah study. Had he not received the afflictions he would be stuck doing other mitzvos and would be unable to devote himself to Torah study. Thus, the Gemara means that if one cannot find any sins that he has committed he should assume that God is trying to enable him to learn more Torah by freeing him from other mitzvah obligations.
ונראה לי לפרש בזה מה שאמרו פ"ק דברכות הרואה אדם יסורים באים עליו יפשפש
במעשיו פשפש ולא מצא יתלה בביטול תורה והדבר הקשה הוא וכי ביטול תורה
אינו חטא כלל עד שאמר פשפש ולא מצא ויראה לי על פי מה שאמרו כי טוב יום
בחצריך מאלף כי טוב יום שהי' דוד עוסק בתורה מאלף עולות שהקריב שלמה המלך
ע"ה והיינו שחביב לימוד התורה לפני הקב"ה יותר מכל המצות אמנם כל אדם
בריא חייב בכל המצות וכ"ש דוד המלך ע"ה שהי' מוטל עליו צרכי ציבור בהנהגת
המלכות והי' מוכרח לבטל קצת מעסק לימוד התורה לכן הקב"ה חפץ דכאו כדי
שיהא פטור מכל המצות ויעסוק בתורה שאף חולה אינו פטור מזה וזהו שאמר טוב
לי כי עניתי למען אלמד חקיך והיינו שהי' מעונה כדי שיוכל לעסוק בתורה וכן
הוא אומר אשרי הגבר אשר תיסרנו יה ומתורתך תלמדנו דהיינו שלא באו היסורים
על עון רק כדי שיוכל לעסוק בתורה שהוא פטור משאר המצות וזהו שאמרו יפשפש
במעשיו אס לא באו היסורים על חטא פשפש ולא מצא יתלה בביטול תורה שהקב"ה
חפץ דכאו כדי שיהא פטור מן המצות המבטלות אותו מלימוד התורה והביאו מן
הפסוק הזה אשרי הגבר אשר תיסרנו יה ומתורתך תלמדנו והיינו כמו שבארנו
This question is also asked by R. Yoseph Ḥayyim of Baghdad in Ben Yehoyada on this Gemara. He answers that one is legitimately allowed to be mevatel Torah in order to earn a living. However, everyone's situation is different and some people require more time to work, while others require less time to work. Each person, therefore, makes his own assessment of how many hours he should be learning and how many hours he should be working. However, it is possible that the person might err in his assessment, and assign more time for working than is actually necessary. In such a case, God will give him afflictions, and if he sees that he has no sins he should assume that God is telling him that he made a mistake in his assessment and he could really be devoting more time to Torah study.
מקשים כיון שיש בידו עון ביטול תורה שהיא חמור איך פשפש ולא מצא ונ"ל
בס"ד כי האדם אינו מחויב לעסוק כל היום בתורה כי הרבה עשו כרשב"י ולא
עלתה בידם אך צריך לקבוע לו שעות לעסק התורה ושאר שעות יעסוק במלאכתו
להביא לחם ביתו אבל זה העסק באמת אין שיעורו שוה אצל כל אדם שיש אדם
יספיק לו לצורך פרנסתו עסק שתי שעות ויש ארבע ויש יותר אך כל אדם צריך
לשער כפי אומד דעתו כמה שעות ביום יספיקו לו לצורך פרנסתו ויעסוק בהם
ואפשר שהוא טועה באומד זה שיעשה אומד שעה או חצי שעה יותר ממה שצריך והוא
אינו מרגיש בזה לכך אם פשפש ולא מצא יתלה בביטול תורה כי יאמר ודאי טעיתי
באומד ואני עוסק שעה או חצי שעה יותר ממה שצריך לי ונמצא אני בטלתי עסק
התורה בהם שלא לצורך