Skip to content

Nextcloud File Sync

DodaTech 3 min read

In this tutorial, you'll learn about Nextcloud File Sync Fails. We cover key concepts, practical examples, and best practices.

Hook

Your Nextcloud desktop client shows "Connecting" for minutes, then "Error: Sync failed." Files you added on your phone appear on the server but never reach your laptop. The sync log is filled with red error entries.

The Wrong Way

Removing the sync folder and re-adding it forces a full re-download of all files — a 100 GB library takes hours and consumes bandwidth unnecessarily.

# BAD: Removing and re-adding the sync connection
rm -rf ~/Nextcloud
# Re-add account — syncs everything from scratch
Downloading 100 GB from scratch...
12 hours remaining
Bandwidth usage: 500 Mbps sustained

A full resync is the slowest possible fix for what may be a simple configuration issue.

The Right Way

Check the sync log, identify the specific error, and fix it without a full resync.

# 1. Open the sync log
# Linux: ~/.local/share/data/Nextcloud/nextcloud.log
# macOS: ~/Library/Logs/Nextcloud
# Windows: %LOCALAPPDATA%\Nextcloud\log
tail -100 ~/.local/share/data/Nextcloud/nextcloud.log | grep -i "error\|fail"
[error] "File /Documents/large-file.bin exceeds file size limit"
[error] "Could not write to /home/user/Nextcloud/file.docx: Permission denied"

Common issues:

  1. File size limit: The server limits uploads. Increase in Nextcloud Admin Settings:
sudo -u www-data php occ config:app:set files max_upload --value="10240"
  1. Local permissions: Fix the local folder:
chmod -R 700 ~/Nextcloud
  1. Blacklisted files: Check the server's excluded file list:
sudo -u www-data php occ config:app:get files blacklisted_files
# 2. Force sync a specific file
# Pause and resume sync from the client menu
# Or use occ to scan files
sudo -u www-data php occ files:scan --all
Scanned 54 files — 1 new, 0 updated, 0 deleted

Prevention

  • Keep the Nextcloud desktop client updated.
  • Set max_upload to at least 10 GB in Admin Settings.
  • Exclude temporary files (*.tmp, *.swp) via the sync client exclusion list.
  • Do not use symlinks inside the sync folder.
  • Pause sync before large file operations on either side.

Advanced Troubleshooting

Check the Logs

Most TOOL errors are logged to stdout or a dedicated log file. Check your logs first:

# Check system logs
journalctl -u tool --since "1 hour ago"

# Or check the application log
tail -50 ~/.tool/logs/error.log

Test with a Minimal Example

Create the simplest possible tool configuration to verify the base setup works:

tool --version
tool --help

If the minimal test passes, add configuration options one at a time until you find the breaking change.

Common Configuration Mistakes

  • Using the wrong file path or URL in configuration
  • Forgetting to restart TOOL after changing config files
  • Mixing tabs and spaces in YAML configuration files
  • Setting incorrect permissions on configuration directories

When to Reinstall

If none of the above resolves the issue, consider a clean reinstall:

# Backup your configuration
cp -r ~/.tool ~/.tool.bak

# Remove and reinstall
# Follow the official TOOL installation guide

This ensures you start from a known good state and can isolate the issue.

Common Mistakes with file sync

  1. Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors
  2. Non-exhaustive pattern matches that compile with warnings then crash at runtime
  3. Misunderstanding that String is [Char] with poor performance for large text operations

These mistakes appear frequently in real-world NEXTCLOUD code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

Why does the client say 'File locked'?

Another sync process or user is modifying the file. Wait for the lock to expire (default: 30 minutes). Force-unlock with occ files:lock <fileid> --unlock if it is stuck.

Can I sync only specific folders?

Yes — in the desktop client, select the account, click "Choose folders to sync", and check only the folders you need locally. This is called selective sync.

Why do .gitignore files cause sync loops?

Hidden files by default are not synced by Nextcloud. If .gitignore triggers constant changes, add it to the server's blacklisted_files list via occ.


DodaTech — sync that just works.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro