Developers are artists just like a writer or a painter. Whether it is developer's own idea or an idea from product management, every developer goes through a creative process to tie multiple ends to deliver a feature that should delight a user.
And just like writer's block or painter's block, developers also run into situations where they are unable to start, lose interest midway or can't complete something that they started. Here are my thoughts on such blockers and how I usually try to overcome them.
Working solo is hard and needs constant motivation and pressure to make progress. Always try to engage with someone in your team or your partner who you can discuss your progress or exchange ideas when stuck. Making yourself answerable to someone (professional or personal) to deliver by some deadline helps with motivation.
Engineers want to build solutions that last forever and over engineer before even one single customer is onboarded. A lot of time is just spent on the ideal approach which can take resources that are not available instead of realistic options that work in the short-term.
For example, imagine working on a solution that needs to process multiple events per second. If you are stuck with designing a system that should process millions of events per second right from the start, you may not even see such a load in the first few years. Consider idealistic usage vs. realistic usage. Often times a simple solution may just work fine in the short or medium-term.
Biting off more than one can chew
If you are clue less where to start for a feature, probably the scope is just too large to find the starting point. Break down the feature to smaller chunks and think about just that smaller scope to get started. Code can always be refactored and APIs can be exposed so all the smaller features can talk to each other to deliver the final larger functionality. But the risk of not starting thinking about the larger scope is worse than starting somewhere.
Delaying the work thinking that certain functionality can be completed over a weekend or overnight and not motivating yourself to do it right now is the most common scenario for a developer's block. I think pretty much every developer procrastinates at some point. But think - there is no point in delaying something if it must be done eventually by you. Delaying it now only causes more pressure later or be answerable for not delivering it on time. But what worked for me is - I force myself to just start, overwork until the feature's happy path is ready, then procrastinate to decompress, handle other possible scenarios and deliver.
Lack of focus and motivation
If you are losing focus and don't feel motivated to write code, it's likely caused by burnout. Taking time-off to recover is okay.