The usual advice is "stay at least two years". Like most round numbers, it is a rule of thumb that has outlived the reason behind it.
Why two years became the standard
It takes roughly six months to become useful in a role, and another six to do it independently. A second year is where you handle a full annual cycle on your own. That is the real reason for the number: it is how long it takes to be able to say you can do the job, not just that you held it.
When leaving before two years is reasonable
The job is materially different from what was described. The company is in financial trouble. There is no longer a manager in your function. Or you are being asked to do something you consider wrong. All of these are explainable in one sentence at your next interview, which is the only test that matters.
When it is not
Leaving because the work got hard, three times in a row, is a pattern a recruiter will see even if each individual reason was fair. Two short stays will be asked about. Three becomes the story of your CV.
The opposite risk nobody warns about
Staying seven years in your first company is also a pattern. It can mean you know one company's way of doing things extremely well and have never had to adapt to another. Hiring managers notice this, particularly for roles that require working across organisations.
A practical test
Ask yourself what you would put on your CV if you left today. If the answer is a clear line about something you built, delivered or improved, you have taken what the job had to give. If the answer is only a job title and a date range, stay until you have more.
What to do while you decide
Write down what you have actually done this year, with numbers, while you still remember it. Whether you stay or leave, that document is worth more than any advice about how long to stay.