question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to create file when trying to open weekly note

See original GitHub issue

So… This is weird, especially after taking a look at the code both in this repo and obsidian-daily-notes-interface.


Whenever I create a weekly note for the first time, everything works as expected. It creates the note in my designated location, and opens it in the editor. However, when I move to another note and invoke the Periodic Notes: Open weekly note command via the command palette, I get the following error in the console:

Failed to create file: 'Journal/Weekly Reviews/2021-W30.md' Error: File already exists.

Which… makes sense. Because the file already exists. But I expected it to just open the weekly note, just like how it works for the daily notes. These are the settings that I’m using at the moment.

image

The only thing I could think of is it being an issue with the “escape characters” used in the Format. I could imagine that the code checks if the file exists (to already open it) is somehow “fooled” when using a character like this, and that would always return false. At the same time though, I tried running window.app.vault.create("Journal/Weekly Reviews/2021-W30.md"); manually from the console, but got the same error. So I’m kind of lost here. Hope you can help me out! 😄

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
svenluijtencommented, Aug 27, 2021

@urdvr you’re absolutely right! Installing the Calendar plugin and setting the “Start week on”-setting to “Monday” does indeed fix the issue. Thanks for your detective work, I couldn’t spot that issue you described but it totally makes sense as to why it’s messing up now.

I’ll leave this issue open if we want to track the bug here, but in the meantime I’ll work around it by just keeping the Calendar plugin installed.

2reactions
urdvrcommented, Aug 28, 2021

This issue happens because the start of the ISO week should be on Monday, but the default is Sunday. Periodic Notes checks if you have a note for the current week, sees that you do not, takes the start of the current week (incorrectly, previous Sunday) and tries to create the file that corresponds to that ISO week. This fails because the file already exists.

The correct solution would be to use isoWeek as the unit of time in const startOfPeriod = date.clone().startOf(config.unitOfTime) in the openPeriodicNote function if the week format is WW. Or just to skip the “take the start of the current week” step.

A workaround that seems to work for me is to install the “Calendar” plugin by the same author (https://github.com/liamcain/obsidian-calendar-plugin) and set the “Start week on” option to Monday. This seems to override the default and I don’t get errors.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to create new file · Issue #66 - GitHub
I'm experiencing this issue, "Unable to create new file" when I try to open the weekly note.
Read more >
Unable to open Weekly notes (hotkey) - Help - Obsidian Forum
Things I have tried What I'm trying to do Part A When I press 'shift+alt+d' ... if (weekly notes does not exists) {create...
Read more >
How to resolve the problem "Word experienced an error trying ...
Cause. This problem usually occurs when the file was altered by a third-party software during the transmission process, and hence the file cannot...
Read more >
Troubleshoot Google Docs, Sheets, Slides & Forms error ...
You can also try to open the same file in another device. If you can open the same document on a different computer,...
Read more >
How to File - Unemployment Compensation - PA.GOV
A resource to help answer any questions you may have about filing or receiving unemployment compensation benefits, including eligibility, how your weekly ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found