christianspecht / scm-backup

Makes offline backups of your cloud hosted source code repositories
https://scm-backup.org/
GNU General Public License v3.0
58 stars 20 forks source link

Error 'Local folder is missing' #76

Closed Crispim14 closed 1 month ago

Crispim14 commented 11 months ago

I'm experiencing issues when running ScmBackup.exe. I performed some tests about 2 months ago, and it worked normally. However, I'm trying to use it again now, but I keep getting the error message "Local folder is missing."

What could be happening? Can you assist me? parsecd_a7uhgrFoBf parsecd_yb3yF5xunu

christianspecht commented 10 months ago

There's only one place in the code where this error message is generated: this line :

        if (String.IsNullOrWhiteSpace(config.LocalFolder))
        {
            this.logger.Log(ErrorLevel.Error, Resource.LocalFolderMissing);
            return null;
        }

(Resource.LocalFolderMissing outputs this exact message)

So it's not about the folder on your machine (or its permissions). The problem is that the localFolder definition in the config file is apparently missing (or SCM Backup somehow wasn't able to detect it).

Can you share your config file (with redacted user/password, of course)?

Crispim14 commented 10 months ago

sure, here is my config file(some coments is in portuguese, cuz I'm Brazilian):

# all backups go here
localFolder: 'C:\BitbucketBackup'

# when an error occurs, wait that many seconds before exiting the application
waitSecondsOnError: 5

# uncomment this to send SCM Backup's console output via email
#email:
#  from: from@example.com
#  to: to@example.com
#  server: smtp.example.com
#  port: 0
#  useSsl: false
#  userName: testuser
#  password: not-the-real-password

sources:

  - title:  bitbucket_bkp
    hoster: bitbucket
    type: org
    name: name
    authName: authname
    password: appPass

options:
    backup:
        # delete repos from local backup that don't exist at the hoster
        removeDeletedRepos : false

restore:
  # Caminho para a pasta onde estão armazenados os backups
  backupFolder: 'C:\BitbucketBackup'

  # Define se os repositórios serão restaurados para os seus locais originais (true) ou para um novo local (false)
  restoreToOriginalLocation: true
christianspecht commented 10 months ago

Is "Local folder is missing" the only error message?

When I replace the content of my config file with yours and run SCM Backup, I get this output (copied from the logfile):

2023-09-06 23:02:54.7501|INFO|ScmBackup|SCM Backup 0.0.0-DEV 
2023-09-06 23:02:54.8057|INFO|ScmBackup|https://scm-backup.org/ 
2023-09-06 23:02:54.8057|INFO|ScmBackup|Operating system: Microsoft Windows 10.0.19045 
2023-09-06 23:03:14.8714|ERROR|ScmBackup|(Line: 14, Col: 1, Idx: 409) - (Line: 14, Col: 1, Idx: 409): Exception during deserialization 
2023-09-06 23:03:43.5356|ERROR|ScmBackup|Local folder is missing! 
2023-09-06 23:03:56.3285|ERROR|ScmBackup|Backup failed! 
2023-09-06 23:03:56.3285|ERROR|ScmBackup|The application will close in 5 seconds! 
2023-09-06 23:04:07.5060|ERROR|ScmBackup|Local folder is missing! 

As I suspected, the localFolder definition in the configuration object is "missing"...because the whole config file could not be deserialized.

I'm not sure what's the root cause, though.
Line 14 is the localFolder definition, "Col: 1" sounds like the first character (the error message is coming from the deserialization library, not from my own code), but even if I open your config file in a text editor which shows special characters, I don't see anything suspicious.

christianspecht commented 10 months ago

OK, now I've got it!

The line number in the error message is misleading...the deserializer seems to check if the file contains some properties that aren't in the object. If yes, it throws this exception.

The problem is this part of the config file, which is not in the original config file and was added by you:


restore:
  # Caminho para a pasta onde estão armazenados os backups
  backupFolder: 'C:\BitbucketBackup'

  # Define se os repositórios serão restaurados para os seus locais originais (true) ou para um novo local (false)
  restoreToOriginalLocation: true

When I remove this, SCM Backup works.

I'm leaving the issue open for now, because I'll try if I can show a better error message.